简体   繁体   中英

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.

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.

However I noticed among the configuration info that there was no loaded configuration file (php.ini). I need to include ldap and other functionalities, by modifying the include_path variable in a configuration file. Thus I added a php.ini file in the location searched by php, and I modified the include_path variable inside it.

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() ?> . Il looks like php is not correctly called from httpd. However when entering echo "<?php phpinfo() ?>" | php echo "<?php phpinfo() ?>" | php in command line, I correctly get the PHP configuration information.

What is wrong here? How can httpd not call PHP correctly because of a PHP configuration file? Where should I look inside this php.ini?

Sounds a SELinux issue, what's the result of

ls -Z /etc/php.ini

Get you something like this?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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