Powerponken Posted December 2, 2010 Share Posted December 2, 2010 Hi, Running Apache 2.2.8 PHP 5.2.5 I have received a system to be doing maintenance on. It is a web application that is running on RedHat Linux. The software is a mixture of C++, PHP, Java, javascript, HTML. The application is bundled together with MySQL server/client, Apache webserver and PHP. There is no information about the pre-requisites to install this system from scratch. My experience is limited regarding all above except C++ and in this case my C++ knowledge doesn’t help much. The Linux version is to be changed to a later one in a new environment and the MySql –server is to be running on a separate machine. PHP and Apache is not to be upgraded. Since the application is installed in /myapp/ all functionality, MySql, PHP, Apache is located under /myapp today. The new environment requires that the top directory is /opt/. This means that my system will now be located like /opt/myapp/. I expected that it would be possible to just copy the /myapp –directory and move it to the new environment. Changes in the defined paths in the system would be necessary of course. All paths starting with /myapp/ are now changed to /opt/myapp/ in the files. The webserver starts in the new environment and it is possible to get some reaction when contacting the system . Unfortunately I only get error messages in the web browser saying that include files and dynamic libraries can not be found and showing a faulty path like this: Unable to load dynamic library '/myapp/httpd/lib/php/extensions/no-debug-non-zts-20070715/myapp.so’ Failed opening 'DB.php' for inclusion (include_path='.:/myapp/httpd/lib/php') I have found out that if I remove /myapp/conf/php.ini in the working old test environment I can get the same error messages as in the new environment. The error messages above seem to include some default paths. I guess that those paths have been compiled in some way. The interesting part is that it seems like the php.ini file affect the execution in the old environment but not in the new one. The problem is probably that the php.ini-file definitions are ignored or the php.ini-file is never read in the new environment. The phpinfo()-function says that the Loaded Configuration File is none so that would explain why the paths are wrong and why they become wrong in the old environment when removing the php.ini-file. What to do about this? Do I have to compile or run some configuration? If the content in the /myapp/ directory would have been moved to a new environment without the new top directory /opt ,these problems would never have been seen or am I wrong? Regards, Kalle Quote Link to comment https://forums.phpfreaks.com/topic/220412-phpini-is-ignored-in-new-linux-environment/ Share on other sites More sharing options...
trq Posted December 2, 2010 Share Posted December 2, 2010 The problem is that the path to the ini file is defined at php's compile time, so, php is looking for the php.ini in the old location. You should be able to make a symlink (from old location to new) to the php.ini which will fix the problem. Quote Link to comment https://forums.phpfreaks.com/topic/220412-phpini-is-ignored-in-new-linux-environment/#findComment-1142080 Share on other sites More sharing options...
Powerponken Posted December 2, 2010 Author Share Posted December 2, 2010 The problem is that the path to the ini file is defined at php's compile time, so, php is looking for the php.ini in the old location. You should be able to make a symlink (from old location to new) to the php.ini which will fix the problem. Yes, that seems to be the problem. Unfortunately I don't understand how to make a symlink from old location to new since the old location does not exist in this new environment. In the old location(old machine) it was located in /myapp/conf/php.ini. In the new location(new machine) it is now located in /opt/myapp/conf/php.ini. The old location does not exist anymore in the new machine. phpinfo() says that the php.ini file is in the /myapp/conf directory. Making a symlink from a non-existent location seems impossible. Is there not a way to change so phpinfo() says to find the file in the /myapp/conf directory? Regards, Kalle Quote Link to comment https://forums.phpfreaks.com/topic/220412-phpini-is-ignored-in-new-linux-environment/#findComment-1142153 Share on other sites More sharing options...
trq Posted December 2, 2010 Share Posted December 2, 2010 Is there not a way to change so phpinfo() says to find the file in the /myapp/conf directory? Not without recompiling php. You'll need to execute this as root. mkdir -p /myapp/conf/ && cd $! && ln -s /opt/myapp/conf/php.ini php.ini Quote Link to comment https://forums.phpfreaks.com/topic/220412-phpini-is-ignored-in-new-linux-environment/#findComment-1142173 Share on other sites More sharing options...
Powerponken Posted December 15, 2010 Author Share Posted December 15, 2010 Is there not a way to change so phpinfo() says to find the file in the /myapp/conf directory? Not without recompiling php. You'll need to execute this as root. mkdir -p /myapp/conf/ && cd $! && ln -s /opt/myapp/conf/php.ini php.ini Thank you for your answer! Unfortunately I don't have root access and the administrators are very reluctant to have anything belonging to my system located anywhere else than in the myapp directory and below Fortunately, we have managed to read the php.ini-file by setting PHPIniDir in httpd.conf so it works now . Quote Link to comment https://forums.phpfreaks.com/topic/220412-phpini-is-ignored-in-new-linux-environment/#findComment-1147891 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.