简体   繁体   English

加载php.ini时未从Apache运行PHP

[英]PHP is not run from Apache when php.ini is loaded

I have compiled and installed Apache 2.2.19 and PHP 5.3.6 in CentOS 5.5. 我已经在CentOS 5.5中编译并安装了Apache 2.2.19和PHP 5.3.6。

I modified httpd.conf to process .php files with php, and it was indeed working as i could see by creating a simple page with <?php phpinfo() ?> in it: the PHP configuration was correctly displayed. 我修改了httpd.conf来使用php处理.php文件,并且通过创建一个简单的页面(其中带有<?php phpinfo() ?>可以看到它的确可以正常工作:正确显示了PHP配置。

However I noticed among the configuration info that there was no loaded configuration file (php.ini). 但是我在配置信息中注意到没有加载的配置文件(php.ini)。 I need to include ldap and other functionalities, by modifying the include_path variable in a configuration file. 我需要通过修改配置文件中的include_path变量来包括ldap和其他功能。 Thus I added a php.ini file in the location searched by php, and I modified the include_path variable inside it. 因此,我在php搜索的位置添加了一个php.ini文件,并修改了其中的include_path变量。

Now is the real problem: when restarting httpd and going back to my simple php page, i only see the text content of the file, that is, <?php phpinfo() ?> . 现在是真正的问题:重新启动httpd并返回到我的简单php页面时,我仅看到文件的文本内容,即<?php phpinfo() ?> Il looks like php is not correctly called from httpd. Il看起来php没有从httpd正确调用。 However when entering echo "<?php phpinfo() ?>" | php 但是,当输入echo "<?php phpinfo() ?>" | php echo "<?php phpinfo() ?>" | php in command line, I correctly get the PHP configuration information. 在命令行echo "<?php phpinfo() ?>" | php中,我正确获取了PHP配置信息。

What is wrong here? 怎么了 How can httpd not call PHP correctly because of a PHP configuration file? 由于PHP配置文件,httpd如何无法正确调用PHP? Where should I look inside this php.ini? 我应该在哪里查看此php.ini?

Sounds a SELinux issue, what's the result of 听起来是SELinux的问题,结果是什么

ls -Z /etc/php.ini

Get you something like this? 得到你这样的东西?

-rw-r--r--  root root system_u:object_r:etc_t          /etc/php.ini

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM