How to configure php environment on mac

王林
Release: 2023-02-26 16:22:01
Original
4906 people have browsed it

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
Copy after login

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

sudo apachectl -v
Copy after login

to view the version information of Apache

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

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
Copy after login

3. Enter

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

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template