-
All replies
-
Helpful answers
-
-
May 29, 2016 3:30 PM in response to shldr2thewheelby MacLady,I have turned on Apache, and get the IT WORKS file.
I created a Sites folder.
But I cannot turn on PHP because the # won't delete and save in the file even though I gave myself permission and in the terminal as well.
Why????
-
May 30, 2016 3:56 PM in response to MacLadyby MacLady,This works and needs to be used on future versions as well.
You will need to enter your password at times.
=============================
To activate the Apache Server
=============================
In the terminal:
sudo apachectl start
to stop it
sudo apachectl stop
to restart it
sudo apachectl restart
To find the Apache version
httpd -v
The "It Works!" page should now be able to be accessed via typing "localhost" into the browser.
=====================
Create a Sites folder
=====================
In the Home folder (House) create a Sites folder and give yourself permission to
read/write to it, using Get Info
Create a “shortusername.conf” file in the Terminal
This one gets you to the folder:
cd /etc/apache2/users
This one creates the file:
sudo nano shortusername.conf
Then add the content below:
<Directory "/Users/shortusername/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Note: Adding in the "FollowSymlinks" to the line
"Options FollowSymLinks Indexes MultiViews" will allow you to have no issues when hosting
WordPress sites with in your Sites folders. I left it out because I work with WP only online.
Permission needs to be set by typing sudo chmod 644 shortusername.conf
Then restart the server:
sudo apachectl restart
=========================
To turn on the PHP module
=========================
In the terminal:
sudo nano /etc/apache2/httpd.conf
Hit the down arrow until you find this line:
LoadModule php5_module libexec/apache2/libphp5.so
Remove the # before it.
Write out and Save using the nano short cut keys at the bottom ‘control o’ and ‘control x’
Re-load apache
sudo apachectl restart
===========
View Sites
===========
Place your PHP website folders in the Sites folder and navigate to
http://localhost/~shortusername/
Your folders should be able to be seen in a list there.
There is a small control panel you can download to turn your server on and off in lieu of the fact there is no Web Sharing button in the Preferences, but I simply turn off the WiFi and disconnect the computer from the internet when not in use for security purposes. I tried the panel and it worked at first, but I had trouble with it later so I uninstalled it.
The Sites folder and Web Sharing button were removed after 10.7
Let's hope they, as well as a more eye-friendly GUI, attractive folders and icons, will come back someday!
-