If you were a user of Web Sharing in OSX then you may have realised that the option for web sharing in Preferences is now gone in Mountain Lion. However the apache2 background is still there ,but all of your configs have been reset(you may find the old backed up ones lying around somewhere) and you will need to bring them back before starting up apache from the terminal.
First things first though, I use php for my web stuff so I want to bring that back first. So I need to edit the file /etc/apache2/httpd.conf and uncomment the line that loads the php module:
LoadModule php5_module libexec/apache2/libphp5.so
Save the file and we should be done(remember we need root permission to save changes to this file).
Next I want to set up my php.ini. Go to /etc in the terminal and sudo cp php.ini.default php.ini
Now edit the php.ini (don't forget the root permissions) to your preferences , I wont provide details on this because it depends whether you are using this machine for the purposes of debugging or running the site(for the latter you wouldn't want php errors being printed all over your site).
The next thing to set up (If you are like me ) is the user settings for apache , I like to use localhost/~username/ to avoid permission issues when debugging a site. For this we need to browse to /etc/apache2/users/ and create a config file for our username:
sudo touch username.conf (replacing username with your username). and then insert the following into the file (again replacing the word username with your username).
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Now its time to restart apache : sudo apachectl restart
Now web sharing with php should be running just fine.
First things first though, I use php for my web stuff so I want to bring that back first. So I need to edit the file /etc/apache2/httpd.conf and uncomment the line that loads the php module:
LoadModule php5_module libexec/apache2/libphp5.so
Save the file and we should be done(remember we need root permission to save changes to this file).
Next I want to set up my php.ini. Go to /etc in the terminal and sudo cp php.ini.default php.ini
Now edit the php.ini (don't forget the root permissions) to your preferences , I wont provide details on this because it depends whether you are using this machine for the purposes of debugging or running the site(for the latter you wouldn't want php errors being printed all over your site).
The next thing to set up (If you are like me ) is the user settings for apache , I like to use localhost/~username/ to avoid permission issues when debugging a site. For this we need to browse to /etc/apache2/users/ and create a config file for our username:
sudo touch username.conf (replacing username with your username). and then insert the following into the file (again replacing the word username with your username).
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Now its time to restart apache : sudo apachectl restart
Now web sharing with php should be running just fine.
Comments
Post a Comment