Mac OS X 10.10 Yosemite under Configuration apache+php

Source: Internet
Author: User
Tags save file


Since the system was upgraded from OS X Mavericks 10.9 to OS X Yosemite 10.10, the configuration of Apache and PHP was not working properly.

Reset the configuration as follows:

First, check the Apache version of the current system and enter it under Terminal: HTTPD-V

  

apache/2.4.0

1. Launch Apache Service
sudo apachectl start
Open Safari, visit: http://localhost, show "It works! "indicates Apache boot normal

The default directory for Apache is currently being accessed./library/webserver/documents/

2. Configure user access to Directory
Since the user directory has been previously configured, here is a list of user directories: mkdir ~/sites creates a Sites directory at the root of the current user
You can create a test HTML in the Sites directory, or Cp/library/webserver/documents/index.html.en ~/sites/

Modify the access permissions for the current user directory, which is consistent with the previous version, and here's how to change it:
Cd/etc/apache2/users
sudo vim username.conf
Note: Here'susernameis the current user name, please modify it according to the actual situation

Enter the following:

<"/users/username/sites/">   Options Indexes multiviews   allowoverride all   Order allow,deny     -</Directory>

Save file, restart Apache, sudo apachectl restart

Modify access permissions for the current file:sudo chmod 775 username.conf

At this point, open Safari, Access http://localhost/~username/, at this time the page prompt ~username Server does not exist, we also need to go to the next setting

3. Modify the Apache httpd.conf file

cd/etc/apache2/

sudo vim httpd.conf

Locate the following message, and then remove the preceding #:

LoadModule php5_module libexec/apache2/libphp5.soloadmodule authz_core_module libexec/apache2/mod_ Authz_core.soloadmodule authz_host_module libexec/apache2/mod_authz_host.soloadmodule userdir_module Libexec/apache2//private/etc/apache2/extra/httpd-userdir.conf

Modify/etc/apache2/extra/httpd-userdir.conf

sudo vim/etc/apache2/extra/httpd-userdir.conf

Find the information to fix it and remove it from the previous #:

Include/private/etc/apache2/users/*. conf

At this time access http://localhost/~username/, still inaccessible, prompt: You do not havepermission to access/~username/on this server.< /c0>

  

Here is the difference between the new version and the old version, the need to reopen the httpd.conf file,

sudo vim/etc/apache2/httpd.conf

Found it

<directory/>    allowoverride None    Require all denied</Directory>

Modified to:

<directory/>    allowoverride None    Require all granted</Directory>

Restart Apache,sudo apachectl Restart

At this time visit: http://localhost/~username/, display: "It works! " Congratulations, Apache configuration is successful!"

  

4. Configure PHP

Cd/etc

sudo cp/etc/php.ini.default/etc/php.ini

sudo apachectl restart

Create a info.php file to test if PHP is installed successfully

CD ~/sites

Vim info.php

Enter the following information:

phpinfo();?>    </body> 

Open the browser, Access http://localhost/~username/info.php, display a message indicating that the PHP installation configuration is successful ~

  

  

Mac OS X 10.10 Yosemite under Configuration apache+php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.