mac PHP configuration, macphp configuration
apache default path configuration method
apache configuration
Apache already comes with it, you only need the following three commands.
Start the apache service sudo apachectl start
Stop the apache service sudo apachectl stop
Restart the service sudo apachectl restart
View version httpd -v
After manually opening the apache service and entering localhost in the browser, you will see the following:
it works
PHPConfiguration
The configuration of PHP is very simple. Just go to the /etc/apache2/ directory, edit httpd.conf, find LoadModule php5_module libexec/apache2/libphp5.so and uncomment it.
Restart apache.
Create a php file in the /Library/WebServer/Documents/ directory for testing.
Virtual directory configuration method
The root directory of the program is under /Library/WebServer/Documents/, and this It works is printed out by the info.php inside. The following describes how to change the default directory of apache to the user directory.
1. Create a new Sites folder in your user directory. My user directory is yanzi.
2. Go to the cd /etc/apache2/users/ directory and sudo vim username.conf. The content is:
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
The yanzi in the first line above is the user directory. Then change the file permissions to 644:
sudo chmod 644 username.conf
3. Go to the /etc/apache2/ directory, sudo vim httpd.conf and remove the comments from the following three sentences:
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
The first two sentences should already be uncommented. Release the annotation on the third sentence.
Then find the Include /private/etc/apache2/extra/httpd-userdir.conf annotation and release it.
PS: Just switch to command mode under vim and enter /"words you need find" to quickly find the words you need to find.
4. Go to the /etc/apache2/extra/ directory,
sudo vim httpd-userdir.conf
Uncomment the sentence Include /private/etc/apache2/users/*.conf.
Then enter in the terminal: sudo apachectl restart to restart apache, enter in the browser: loacal/~yanzi/ and you will see the effect. (yanzi is the name of my user directory, no need to add /Sites after it)
After the above steps, apache is ready
http://www.bkjia.com/PHPjc/1115254.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1115254.htmlTechArticlemac PHP configuration, macphp configuration apache default path configuration method apache configuration apache already comes with it, just need the following three Just one command is enough. Start the apache service sudo apachectl start to stop...