好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

在Mac OS X中配置Apache + PHP + MySQL 很详细

    ServerAdmin webmaster@dummy-host.example.com       DocumentRoot "/usr/docs/dummy-host.example.com"       ServerName dummy-host.example.com       ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"       CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common   </ VirtualHost >   < VirtualHost *:80 >       ServerAdmin webmaster@dummy-host2.example.com       DocumentRoot "/usr/docs/dummy-host2.example.com"       ServerName dummy-host2.example.com       ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"       CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common   </ VirtualHost >   

而实际上,这两个虚拟主机是不存在的,在没有配置任何其他虚拟主机时,可能会导致访问localhost时出现如下提示:

Forbidden You don‘t have permission to access /index.php on this server

最简单的办法就是在它们每行前面加上#,注释掉就好了,这样既能参考又不导致其他问题。

增加如下配置 XML/HTML代码 < VirtualHost *:80 >       DocumentRoot "/Users/[用户名]/Sites"       ServerName sites       ErrorLog "/private/var/log/apache2/sites-error_log"       CustomLog "/private/var/log/apache2/sites-access_log" common   </ VirtualHost >  

保存退出,并重启Apache。

运行[sudo vi /etc/hosts],打开hosts配置文件,加入]127.0.0.1 sites[,这样就可以配置完成sites虚拟主机了,这样就可以用[http://sites]访问了,其内容和[http://localhost/~[用户名]]完全一致。

这是利用Mac OS X 10.6.3中原生支持的方式来实现的配置,也可以参考[Mac OS X Leopard: 配置Apache, PHP, SQLite, MySQL, and phpMyAdmin(一) ]和[Mac OS X Leopard: 配置Apache, PHP, SQLite, MySQL, and phpMyAdmin(二) ]。实际上,你还可以使用XAMPP或MacPorts这种第三方提供的集成方案来实现简单的安装和使用。

--------
值得一观

原文链接:膘叔

在Mac OS X中配置Apache + PHP + MySQL 很详细

标签:

查看更多关于在Mac OS X中配置Apache + PHP + MySQL 很详细的详细内容...

  阅读:25次