Jump to content

I don't have a /etc/php.ini, is it a problem?

Recommended Posts

Hello everybody, I'm using OpenSUSE 13.1 and PHP 5.4.20, which was installed from OpenSUSE's official repository. The problem is that I have no /etc/php.ini, although I have a php.ini in 3 other locations:

# find /etc -name php.ini
The page phpinfo.php loads correctly in localhost and it points that php.ini location is /etc/php5/apache2/php.ini . Is this normal or is it mandatory to have a /etc/php.ini file? Do I must copy one of the others php.ini to the /etc directory? If yes, which one of them?
Edited by renatov
Link to comment
Share on other sites

That's totally normal, leave it be: the OpenSUSE folks deliberately set up PHP to be like that so it'll work just fine. The idea is that you can run PHP three different ways (Apache module, command-line, and using FastCGI) so it can help to have three different configurations.

Link to comment
Share on other sites

Thanks for your reply! If I want to change a configuration, do I have to change it in the three different files?

Only in the file which phpinfo says is THE file.


PHP.ini is nothing more than a text file with a list of settings, it doesn't matter whatsoever where the file is located on your server so long as:

 a ) PHP has permission to access it

 b ) Apache is pointing to the correct path of the file


There's no "correct" place to keep your php.ini file to answer your question.  Some people even have them in their webroot along with all of their other web-accessible files.

Link to comment
Share on other sites

Thanks for your reply! If I want to change a configuration, do I have to change it in the three different files?

If you want the change reflected in all three environments, then yes you would. Another option would be change two of the files to symlinks pointing to the third, then you would only need to edit one file.


The reason it is setup like it is by default is so that you can have different configuration settings for CLI vs CGI vs Apache Module. CLI for example commonly has less restrictions as it's a more controlled environment and serves a different purpose.

Link to comment
Share on other sites

"Apache's php.ini" otherwise known as a server side include allows Apache to use PHP whenever it needs it.


The CGI way is quite old.  When using this method of PHP installation, you must call the PHP interpreter when you want to use it.  In other words, the CGI way would be for those who do not intend to use PHP much, if at all.


FastCGI is a mix of the two, which I have yet to try.


Most PHP-heavy websites should be using the Apache SSI installation of PHP.

More information here


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.