4

Running PHP/Apache on a redhat 6.5 environment. Running into some issues with the PHP installation. PHP was installed and compiles from source and I used the following command to configure it.

'./configure' '--prefix=/u/g/php' '--with-libxml-dir=/u/g/util/libxml2/' '--with-apxs2=/u/g/apache/bin/apxs' '--with-config-file-path=/u/g/php/config' '--enable-mbstring'

This works I can run php and appache. However I am trying to enable some extension and the php.ini file I have configured is not getting read.

In the php_info() it has

Configuration File (php.ini) Path   /u/g/php/config

However as I understand it, it should contain the file like so /u/g/php/config/php.ini

Started/stopped the service..

Any ideas?

2
  • 1
    There should be another line that says, "Loaded Configuration File" at the start - that'll be what you're after. Mine is, "Loaded Configuration File => /usr/local/etc/php/5.5/php.ini" Commented Sep 10, 2014 at 20:43
  • Can the user that PHP is running read and list /u, /u/g, /u/g/php, /u/g/php/config, and /u/g/php/config/php.ini? Not that all individual dirs need to have their rx bits set for that user, group, or anybody. Also, if Redhat, SELinux might come into play... Commented Sep 10, 2014 at 22:29

2 Answers 2

10

Most servers have more than one php.ini file. My best guess is that you're editing the wrong one. To see which one is actually being used by php, run this:

<?php
$inipath = php_ini_loaded_file();

if ($inipath) {
    echo 'Loaded php.ini: ' . $inipath;
} else {
    echo 'A php.ini file is not loaded';
}
?>

Edit: if this returned 'not loaded', try this in SSH:

php --ini

Or do this in php:

phpinfo();

http://php.net/manual/en/function.php-ini-loaded-file.php

Also, be sure to restart apache after changing the php.ini file.

Sign up to request clarification or add additional context in comments.

2 Comments

So I deleted the entire php directory. And recompiled it. Somehow it magically works. I must have screwed up the php directory somehow..
Cool. Glad I could help, at least to help narrow it down perhaps :)
1

Sometimes due to error in php.ini files the configuration files are not loaded after that specific error line. In that case you have to thoroughly check the php.ini file and fix the errors.

Alternatively you can download fresh php.ini files for your php version and replace your existing file with the new one.

After making changes in the new file restart your server using service apache2 restart

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.