The simplest and most straightforward way to do this is to use Apache and PHP, which comes with your Mac. 1. Launch Apache1> start Apache $sudo apachectl start; after 2> is started, enter localhost in the browser and you can see It works on the page. (Index.html.en file under/library/webserver/documents/)the default root directory for 3>apache is /library/webserver/documents/ 2. Add Apache support for PHP1> Open the http.conf configuration file:sudo vim/etc/apache2/httpd.conf2> Find the following code and remove the comment (remove the previous ' # '), Wq Save the exit. LoadModule Php5_module libexec/apache2/libphp5.so3. Restart Apache for PHP type file debuggingRestart : sudo apachectl restart Create a new project folder under the root directory of Apache/library/webserver/documents/and write a php file to output ' Hello World '. At this point, in the browser open http://localhost/project/test.php can normally see Hello World ~(If you have permission problems, sudo chown yourname:staff project where yourname is your own name) 4. Install MySQL using homebrewInstalling Homebrewruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"install MySQLBrew Install MySQLstart MySQLmysql.server StartApache Common Commands//Start Apache servicesudo apachectl start //Restart Apache service sudo apachectl restart //close Apache service sudo apachectl stop //view Apache version httpd-v
PHP Development environment configuration of MAC system