Home  >  Article  >  Backend Development  >  How to configure php environment on mac

How to configure php environment on mac

王林
王林Original
2019-10-14 17:56:594834browse

How to configure php environment on mac

1. Start Apache

Two methods

1. Open network sharing

Open" System Preferences"->"Sharing", put a √ in front of the "Internet Sharing" item.

2. Open the terminal and enter

sudo apachectl start

. At this time, you need to enter the password. Just enter the computer password. Then enter

sudo apachectl -v

to view the version information of Apache

Server version:Apache/2.2.24(Unix)Server built:Jul7201318:05:17

At this time, enter http://localhost in the browser, and It works! Page

2. Run PHP

1. Find the Apache configuration file. In the directory /etc/apache2/, open Finder and select "Go"-" Go to the folder", enter "/etc/apache2/", find the "httpd.conf" file, choose to open it with document for editing, click Command F, search #LoadModule php5_module libexec/apache2/libphp5.so

2. Restart Apache and enter

sudo apachectl restart

3. Enter

sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php

in the terminal to copy the index.html.en file in the root directory of Apache and rename it to info.php .

3. Configure MySql

1. On the http://dev.mysql.com/downloads/mysql/ website, select the Mac OS X platform

2. Change the password

Enter in the terminal, change the password here to 123456, or it can be other, just customize it

/usr/local/mysql/bin/mysqladmin -u root password 123456

Recommended tutorial: PHP video Tutorial

The above is the detailed content of How to configure php environment on mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn