Home > php教程 > php手册 > Apache+php configuration issues when upgrading MAC to 10.10 (OS X Yosemite)

Apache+php configuration issues when upgrading MAC to 10.10 (OS X Yosemite)

WBOY
Release: 2016-07-09 09:10:23
Original
926 people have browsed it

After the MAC was upgraded to the latest system, the locally tested site could not run normally. The reason was that after the mac system was upgraded, the version of apache was also upgraded

Server version: Apache/2.4.9 (Unix)

Server built: Sep 9 2014 14:48:20

The version before upgrade is 10.9

<em><strong>Server version: Apache/2.2.26 (Unix)
Server built:   Dec 10 2013 22:09:38<br><br>基本上之前配置的block都被覆盖了<br>所以导致站点不能正常工作<br>解决办法是<br>1 重新启用php 以避免php的脚本文件直接显示到网页上<br></strong></em>
Copy after login
sudo mvim /etc/apache2/httpd.conf
Copy after login
<span class="s1">打开文件后 回车 输入 <br></span>
Copy after login
/LoadModule php5_module libexec/apache2/libphp5.so
Copy after login
再文件中找到该行 去掉前面的#<br>保存即可<br><br><strong><em>2、开启支持用户级目录 http://localhost/~username/<br><br></em></strong>用户级目录不能访问了
Copy after login
<span style="color: #000000;">Not Found
The requested URL /~zhuzi/ was not found on this server.</span>
Copy after login
<em><strong>配置用户级目录的.conf(一般会在用户级的根目录下有一个~/Sites)的目录 该目录就是用户级的站点 <br>没有的话需要重新创建<br>sudo mkdir ~/Sites<br>这时需要配置zhuzi.conf<br></strong></em>
Copy after login
sudo mvim /etc/apache2/users/zhuzi.conf 
Copy after login

Add the following code (10.10) configuration method

<Directory "/Users/zhuzi/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Require all granted
</Directory>
Copy after login

Then change the directory permissions

sudo chmod 775 /etc/apache3/users/zhuzi.conf
Copy after login

You also need to configure httpd.conf

sudo mvim /etc/apache2/httpd.conf
Copy after login

Use vim’s search command to find a few blocks and remove the # in front of them

<span style="color: #000000;">LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
Include /private/etc/apache2/extra/httpd-userdir.conf</span>
Copy after login

Configure httpd-userdir.conf

sudo nano /etc/apache2/extra/httpd-userdir.conf
Copy after login

Remove the # before this block

Include /private/etc/apache2/users/*.conf
Copy after login

Restart apache

sudo apachectl restart
Copy after login

You can access it here

http://localhost/~zhuzi/
Copy after login

<em><strong><br><br><br></strong></em>
Copy after login
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template