System Level Web Root
The default system document root is still found athttp://localhost/
The files are shared in the filing system at
/Library/WebServer/Documents/For mac, the default php config is disabled, so here I will show you how to start the PHP server on Mac
If you are going to use the document root at /Library/WebServer/Documents it is a good idea to allow any .htaccess files used to override the default settings – this can be accomplished by editing the httpd.conf file at line 217 and setting the AllowOverride to All and then restart Apache.
sudo nano /etc/apache2/httpd.confAlso whilst here allow URL rewrites so your permalinks look clean not ugly.
Use the search "Control + W"
Uncomment in httpd.conf
LoadModule rewrite_module libexec/apache2/mod_rewrite.soType in Terminal
sudo nano /etc/apache2/httpd.confUse “control” + “w” to search within nano and search for ‘php’ this will land you on the right line then uncomment the line (remove the #):
LoadModule php5_module libexec/apache2/libphp5.soWrite out and Save using the nano short cut keys at the bottom ‘control o’ and ‘control x’ Reload apache to kick in
sudo apachectl restart
To see and test PHP, create a file name it “phpinfo.php” and file it in your document root with the contents below, then view it in a browser.
No comments:
Post a Comment