Home > Article > Backend Development > Detailed graphic and text explanation of setting up PHP development environment under Macbook Pro
新学PHP, it is the first time to set up a PHP development environment on Macbook, so it is recorded and provides a reference for other learning partners.
Apache 2.4.16
// Start Apache service
sudo apachectl start
// Restart the Apache service
sudo apachectl restart
// Stop the Apache service
sudo apachectl s
top // View Apache Version
httpd -v
1. Open the terminal and enter the command: sudo apachectl start
2. Open the browser and enter localhost in the address bar. If It Works
string appears, it means Apache has been started successfully
3. Under Macbook pro, the root directory of Apache's website server is in the /Library/WebServer/
Documents path
configuration file in the terminal Enter the command:
sudo vim /etc/apache2/httpd.conf
Open the httpd.conf file
localhost:~ alexkw$ sudo vim /etc/apache2/httpd.conf2. Remove the
comment symbol from the content marked in the red box. LoadModule php5_module libexec/apache2/libphp5.so
Then save
3. Restart the Apache service
localhost:~ alexkw$ sudo apachectl restart4. Enter /Library/WebServer/Documents,
In this Create a new test PHP page in the directory and enter the command: sudo vim test.php
5. Enter the following code in test.php
The above is the detailed content of Detailed graphic and text explanation of setting up PHP development environment under Macbook Pro. For more information, please follow other related articles on the PHP Chinese website!