Today is 2017 August 20, into the Yunnan Douen network three days, because the work needs, so read the next PHP, hope in the future to communicate with you learn.
Apache is providing HTTP services.
Setting up a PHP environment on a Mac is really simple and does not require any integrated environment Mamp (mac+apache+mysql+php). The Mac OS system comes with PHP and Apache. We pull up the terminal tool and tap the following command:
Php-v
Apachectl-v
You can see that the PHP version on my computer is 5.6,apache version 2.4.
1. Configure Apache
Then we have to change a place, I create a new folder in the user directory apache-www, for the HTTP service to hold the file (PHP file or HTML file).
Apache has a very important file is httpd.conf, this file in/ect/apache2
To modify the httpd.conf file, tap the command:
sudo vim httpd.conf
File modification of the following two places
LoadModule Php5_module ... This place does not have the previous # number, remove the comment.
Change the path behind DocumentRoot and directory to the newly created folder below the user directory, pointing to it.
There is also a listen 80, you can modify the port number.
and then save. (about how to operate the file in the terminal command line self-baidu ~)
Open the Apache-www folder under the user directory, create a new file index.php, and write a line of code:
<? PHP Phpinfo ();? >
Open Apache service, Terminal knock Command: (sudo requires root user privileges to open)
sudo apachectl start
Open the browser, enter http://127.0.0.1/index.php, you can access the Apache-www directory under the index.php file, output php some information.
Close Apache service to knock the following command:
sudo apachectl stop
Build PHP environment on "Juincen" Mac