构建和安装完成没有任何错误。这个系统上没有安装任何其他的PHP。
该模块似乎是在apache中加载的:
# grep -i php /etc/httpd/conf/httpd.conf
LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so
和
# apachectl -M | grep php
php5_module (shared)
我在/usr/lib64/httpd/modules/libphp5.so和我构建的内容上做了一个差异 - 它们是同一个文件。
Php似乎从命令行执行ok。
# /usr/local/php54/bin/php -f /var/www/html/phpinfo.php | more
phpinfo()
PHP Version => 5.4.29
System => Linux xxxx.xxx.com 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64
Build Date => Aug 7 2014 14:30:39
Configure Command => './configure' '--prefix=/usr/local/php54' '--with-config-file-path=/usr/local/php54/etc' '--with-config-file-scan-
dir=/usr/local/php54/etc/php.d' '--with-libdir=lib64' '--with-mysql' '--with-mysqli' '--with-pdo-mysql' '--enable-mbstring' '--disable-de
bug' '--disable-rpath' '--with-bz2' '--with-curl' '--with-gettext' '--with-iconv' '--with-openssl' '--with-gd' '--with-mcrypt' '--with-pc
re-regex' '--with-zlib' '--with-apxs2'
Server API => Command Line Interface
...blah blah
启动时apache的错误日志中没有显示任何内容:
# more /var/log/httpd/error_log
[Fri Aug 08 12:40:57 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Aug 08 12:40:57 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Aug 08 12:40:57 2014] [notice] Digest: done
[Fri Aug 08 12:40:57 2014] [warn] ./mod_dnssd.c: No services found to register
[Fri Aug 08 12:40:57 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.4.29 configured -- resuming normal operations
我的测试脚本是:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
当我使用firefox从同一主机点击该页面时,我从浏览器获得的是:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
我在这里缺少什么?
selinux完全禁用
# getsebool -a | egrep 'cgi|builtin_scriptin'
getsebool: SELinux is disabled
的php.ini:
# grep -v ';' /usr/local/php54/etc/php.ini | sed '/^\s*$/d'
[PHP]
engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
答案 0 :(得分:1)
问题不在于您php.ini
的最可能性,可能是您的Apache配置。
你的Apache LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so
中有httpd.conf
,所以Apache知道要使用PHP,但是你需要确保你有一个像AddType application/x-httpd-php .php
这样的行,以便Apache知道时使用它。