Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

When I make any changes in php.ini located in /usr/local/lib on centos, the changes don't appear to be applied, for example, when I clear all the content of php.ini and restart Apache everything works fine...

I searched for php.ini and it is in one place in system... what's the problem? How can I fix this?

share|improve this question
    
How did you search for this file? What command did you use? What paths did you look into? –  Khaled Jan 13 '13 at 14:17
    
@Khaled i searched with this way: whereis php.ini –  Fcoder Jan 13 '13 at 14:19
    
How many php.ini's do you have (E.g. check with find / -name php.ini -print). –  Hennes Jan 13 '13 at 14:21
    
Try find /etc -name php.ini. –  Khaled Jan 13 '13 at 14:23
    
i have only one at: /usr/local/lib/php.ini –  Fcoder Jan 13 '13 at 14:24

3 Answers 3

up vote 0 down vote accepted

if you're unsure what php.ini is being used, create a new file in your webfolder, name it phpinfo.php for example , with the following content

<?php
phpinfo();
?>

then open the url in your browser (http://www.example.com/phpinfo.php). it will show the path to the php.ini being used.

when you have identified the correct file, make your desired changes, and be sure to remove the leading ; in case there is one to activate the setting.

restart apache and reload the phpinfo page, your changed setting should now show up. if it doesn't, make sure you don't have a .htaccess file in your webroot that overrides php settings.

share|improve this answer
    
i do this an this is output: Configuration File (php.ini) Path /usr/local/lib Loaded Configuration File /usr/local/lib/php.ini –  Fcoder Jan 13 '13 at 14:28
    
what value did you try to change? did you remove the leading ';' to activate the setting? –  Gryphius Jan 13 '13 at 14:38

you might have php.ini file in your webroot.

share|improve this answer

Follow this:

Create a file inside your webroot naming it whatever you want. I usually prefer x.php

 # vim x.php

The contents of the file should be this:

<?php
phpinfo();
?>

Now open this file in your browser like this:

http://server_ip/x.php

This will show you the location of the php.ini your apache is using. Edit that php.ini and it will work.

share|improve this answer
    
i do this an this is output: Configuration File (php.ini) Path /usr/local/lib Loaded Configuration File /usr/local/lib/php.ini –  Fcoder Jan 13 '13 at 14:29
    
That means you are using this file only. Any changes to this file will be reflected in Apache. You can test the same with the same URL. Make some change in some variable in this php.ini, and that will be reflected in x.php file in browser. –  GeekRide Jan 13 '13 at 14:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.