renatov Posted February 27, 2014 Share Posted February 27, 2014 (edited) 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 /etc/php5/fastcgi/php.ini /etc/php5/cli/php.ini /etc/php5/apache2/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 February 27, 2014 by renatov Quote Link to comment Share on other sites More sharing options...
requinix Posted February 27, 2014 Share Posted February 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
renatov Posted February 27, 2014 Author Share Posted February 27, 2014 Thanks for your reply! If I want to change a configuration, do I have to change it in the three different files? Quote Link to comment Share on other sites More sharing options...
Zane Posted February 27, 2014 Share Posted February 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
kicken Posted February 27, 2014 Share Posted February 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
renatov Posted February 27, 2014 Author Share Posted February 27, 2014 Things are much more clear now, thanks so much, guys! Only one more question, what's the difference between Apache's php.ini and CGI's php.ini? Quote Link to comment Share on other sites More sharing options...
Zane Posted February 27, 2014 Share Posted February 27, 2014 "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 http://blog.layershift.com/which-php-mode-apache-vs-cgi-vs-fastcgi/ Quote Link to comment Share on other sites More sharing options...
renatov Posted February 27, 2014 Author Share Posted February 27, 2014 Thank you, Zane! That clears up all my questions. I appreciate your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.