簡體   English   中英

我在centos 6.5上從源代碼構建了php 5.4-盡管一切似乎正常,但它在apache中不起作用

[英]I built php 5.4 from sources on centos 6.5 - it doesn't work in apache despite everything seeming ok

構建和安裝完成,沒有任何錯誤。 此系統上未安裝其他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]

問題不在於您的php.ini很有可能與您的Apache配置有關。

您在Apache httpd.conf具有LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so ,因此Apache知道要使用PHP,但是需要確保您有一行類似於AddType application/x-httpd-php .php以便Apache知道何時使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM