Home  >  Article  >  Backend Development  >  How to change php default directory under mac

How to change php default directory under mac

王林
王林Original
2021-06-18 14:39:422449browse

The method to change the default directory of PHP under mac is: first open the configuration file and create the Sites folder under the user name; then modify the DocumentRoot attribute and add relevant code to the configuration file; finally restart the apache server. .

How to change php default directory under mac

The operating environment of this article: Mac OS X 10.10.1 system, PHP 5.6&&Apache 2.4.2, macbook pro computer.

We all know that after setting up a php server on a mac, the default path is generally /Library/WebServer/Documents. But for some needs, we may need to modify the default path, so how should we do it? Let’s take a look.

Assumption: The user name of mac is MuyunLee. The following uses tangjr as an example.

The specific steps are as follows:

Open the file /private/etc/apache2/httpd.conf

Find

LoadModule userdir_module libexec/apache2/mod_userdir.so

and remove

Create the folder Sites under the user name

Modify the DocumentRoot in the /private/etc/apache2/httpd.conf file to:

DocumentRoot "/Users/MuyunLee/PHPWorkSpace"

Create the file /private/etc/apache2 /users/MuyunLee.conf

and enter the following code in the file

Options Indexes MultiViews AllowOverride All Require all granted # OSX 10.10 / Apache 2.4

Find the /private/etc/apache2/httpd.conf file and change

Options FollowSymLinks Multiviews

to

Options FollowSymLinks Multiviews Indexes

Restart apache server

sudo apachectl restart

Free video tutorial sharing: Programming video

The above is the detailed content of How to change php default directory under 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

Related articles

See more