First, preface
Encounter problems today, how to configure Apache on the Mac, the original Mac with Apache, just need to open their own configuration on the line.
Second, step:
1. Modify Apache http_conf files
Open the Finder to/private/etc/apache2, and in this file there is a http.conf open with a text editor.
Change the first place : Find PHP. Get the following results
#LoadModule Php5_module libexec/apache2/libphp5.so
Remove the previous # number.
Modify second place : Find DocumentRoot. Will find a similar statement
# # Documentroot:the directory out of which you'll serve your# documents. By default, all requests is taken from the This directory, but# symbolic links and aliases is used to point to other Loca tions. #DocumentRoot "/users/admin/sites" <directory "/users/admin/sites" > # # Possible values for the Options directive is "None", "All", # or any combination of: # Indexes includes followsymlinks Symlinksifown Ermatch execcgi multiviews # Note that "MultiViews" must being named *explicitly*---"Options all" # doesn ' t g Ive it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options followsymlinks multiviews multiviewsmatch any
Enter your own path in the DocumentRoot "" quotation mark. Mine is in the Users/admin/sites, and at the same time, the next to the directory of "" After the quotation marks also changed to their own path.
Modify the third place : find: Directory. Similar statements will be found
# # "/library/webserver/cgi-executables" should be changed to whatever your scriptaliased# CGI directory exists, if you hav E that configured.#<directory "/library/webserver/cgi-executables" > allowoverride none Options None Require all granted</directory> <ifmodule mime_module> # # typesconfig points to the file Containing the list of mappings from
Change the contents of <Directory></Directory> to me.
and then save.
Step Two: Restart Apache
Here are the commands you use.
Stop service: Sudo/usr/sbin/apachectl stop start service: Sudo/usr/sbin/apachectl Start Restart Service: sudo/usr/sbin/apachectl restart
Then, you just create a new PHP file test in the folder you specified. (My in /users/admin/sites)
Configure Apache under Mac