在Red Hat(kernel 2.6)上通过Apache 2.2.15运行PHP 5.3.3,
我在名为test.php的根目录下有一个testing文件:
<? phpinfo(); ?>
当我把浏览器指向这个文件时,它会把这个源文件解释给我。
日志中没有显示错误,访问日志中有一个标准条目:
xx.xx.xx.xx - - [29/Nov/2012:10:26:56 -0500] "GET /test.php HTTP/1.1" 200 17 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.91 Safari/537.11"
我的configuration文件有以下几行:
/etc/httpd/conf/httpd.conf中
... Include conf.d/*.conf ...
/etc/httpd/conf.d/php.conf
# # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. # <IfModule prefork.c> LoadModule php5_module modules/libphp5.so </IfModule> <IfModule worker.c> LoadModule php5_module modules/libphp5-zts.so </IfModule> # # Cause the PHP interpreter to handle files with a .php extension. # AddHandler php5-script .php AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php # # Uncomment the following line to allow PHP to pretty-print .phps # files as PHP source code: # #AddType application/x-httpd-php-source .phps
启动时不logging错误,这表明模块确实正确地加载了。
这是所有开箱即用的configuration,所以我真的很惊讶这不仅仅是工作。 有任何想法吗?
叹息为什么经过几个小时的search,你什么也找不到。 但是,在发布到SO后2分钟才能得到答案?
所以,无论我从哪个站点拷贝那个testing文件,都没有考虑到短标签默认是closures的。 将testing文件更改为
<?php phpinfo(); ?>
修好一切