mac OS X (10.10.1 14B25)上启用apache可以但是启动不了php
zx:users zx$ apachectl -v && php -v
Server version: Apache/2.4.9 (Unix)
Server built: Sep 9 2014 14:48:20
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
zx:~ zx$ cat /etc/apache2/httpd.conf | grep "authn_core.so" -C4
#LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
#LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
#LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
#LoadModule authn_socache_module libexec/apache2/mod_authn_socache.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
#LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
zx:~ zx$ cat /etc/apache2/httpd.conf | grep "mod_userdir" -C2
#LoadModule actions_module libexec/apache2/mod_actions.so
#LoadModule speling_module libexec/apache2/mod_speling.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
zx:~ zx$ cat /etc/apache2/extra/httpd-userdir.conf | grep "Include" -C2
# for a site where these directories are restricted to read-only.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
RegisterUserSite customized-users
zx:~ zx$ cat /etc/apache2/users/zx.conf
<Directory /Users/*/Sites>
DirectoryIndex index.html index.php index index.html default.html default.htm
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Require all granted
</Limit>
<LimitExcept GET POST OPTIONS>
Require all denied
</LimitExcept>
</Directory>
zx:~ zx$ cat /etc/apache2/httpd.conf | grep "libphp5" -C2
LoadModule alias_module libexec/apache2/mod_alias.so
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
zx:~ zx$ sudo apachectl restart
Password:
zx:~ zx$ apachectl -t
Syntax OK
BUT,php do NOT work,
https://www.computersnyou.com/3376/setup-apache-php-mysql-macosx-10-10-yosemite/
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
Do any one can spare some time to help me?
thanks in advance.
zuoxue[at]qq[dot]com
1
urmyfaith OP |
2
jinzhe 2014-12-11 17:21:02 +08:00 1
http://jinzhe.net/post/32.html
昨天刚做的笔记,希望对你有用! |
3
macdino 2014-12-11 18:13:40 +08:00
三步:
1、没有加载对PHP的扩展 2、没有重启APACHE 3、没有重启机器。。。。 |
4
urmyfaith OP |
5
urmyfaith OP @jinzhe 发现问题了.
在apache2目录下有个httpd.conf~prev之类的文件, = = 这个文件会影响httpd.conf配置. 另外的一个问题是:怎么设置虚拟目录? 有详细的过程么? 网上的看着都不详细. 我试着配置了下,也没有出来, 27 <VirtualHost *:80> 28 DocumentRoot "dir" 29 ServerName iosfile 30 <Directory "dir"> 31 Options Indexes 32 IndexOptions NameWidth=50 Charset=UTF-8 33 Order deny,allow 34 Allow from all 35 </Directory> 36 </VirtualHost> 在httpd.conf里也开启了 include http-v 505 # Virtual hosts 506 Include /private/etc/apache2/extra/httpd-vhosts.conf 在hosts文件里也设置了 127.0.0.1 iosfile 为什么会出现没有权限访问? |
6
jswxg 2014-12-11 23:22:36 +08:00 1
打开 httpd.conf 文件,找到 IfModule mime_module 节点。
在下面添加:AddType application/x-httpd-php .php 即可。 |
8
aksoft 2014-12-14 20:16:19 +08:00
nginx php 吧
|
9
aksoft 2014-12-14 20:16:28 +08:00 1
|
10
zzhsdu 2016-11-03 09:24:12 +08:00
您好 我现在还是无法启动 php 跟您的情况一样 请问您说的那个 httpd.conf~prev 之类的文件应该怎么修改他的内容啊?可以告诉我么
|
11
urmyfaith OP |
12
urmyfaith OP ## macOS10.12 安装更新
升级了下 php 到 php71 最近又 TM 安装错误,搞了好久,才发现,文件修改错了!!!! 错误日志 ``` ➜ apache2 tail -f /usr/local/var/log/apache2/error_log [Sat Jan 07 14:23:59.090137 2017] [mpm_prefork:notice] [pid 14789] AH00173: SIGHUP received. Attempting to restart AH00557: httpd: apr_sockaddr_info_get() failed for zuoxue.local AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [Sat Jan 07 14:24:09.133565 2017] [mpm_prefork:notice] [pid 14789] AH00163: Apache/2.4.23 (Unix) PHP/7.1.0 configured -- resuming normal operations [Sat Jan 07 14:24:09.133724 2017] [core:notice] [pid 14789] AH00094: Command line: '/usr/local/Cellar/httpd24/2.4.23_2/bin/httpd' [Sat Jan 07 14:25:03.165816 2017] [mpm_prefork:notice] [pid 14789] AH00173: SIGHUP received. Attempting to restart AH00557: httpd: apr_sockaddr_info_get() failed for zuoxue.local AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message [Sat Jan 07 14:25:13.205196 2017] [mpm_prefork:notice] [pid 14789] AH00163: Apache/2.4.23 (Unix) PHP/7.1.0 configured -- resuming normal operations [Sat Jan 07 14:25:13.205367 2017] [core:notice] [pid 14789] AH00094: Command line: '/usr/local/Cellar/httpd24/2.4.23_2/bin/httpd' ``` 看到这个错误日志,才发现是不是使用的系统的 httpd 了。 `/usr/local/Cellar/httpd24/2.4.23_2/bin/httpd` 非常好的一个安装说明: - [https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions]( https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions) brew 安装的 apache 的配置文件位于 `/usr/local/etc/apache2/2.4/httpd.conf` 系统 自带的 apache 的配置文件位于 `/ etc/apache2/httpd.conf` *tips* 查看 httpd 是系统的还是自带的,可以通过 active monitor (活动监视器)找到 httpd 进程,进行 sample (采样),查看加载的模块就可以判断出来了 。 |