PHP.ini does not load automatically, even if it exists in the configuration location

Well, that’s probably only I don’t know enough about php, but here it goes.

I'm on Ubuntu Hardy. I have a custom compiled version of PHP that I compiled with these options.

./configure --enable-soap --with-zlib --with-mysql --with-apxs2=[correct path] --with-config-file-path=[correct path] --with-mysqli --with-curlwrappers --with-curl --with-mcrypt 

I used the pecl install pecl_http to install the http.so extension. It is in the correct module directory for my php.ini. My php.ini is loading and I can change things inside ini and effect php. I have included the extension=http.so in my php.ini.

This worked fine. Until I added these compilation options to add imap

 --with-openssl --with-kerberos --with-imap --with-imap-ssl 

Which failed because I need a c-client library that I fixed with apt-get install libc-client-dev After which php compiles fine and I have working support for imap, woo.

HOWEVER, now all my calls to HttpRequest, which are part of the pecl_http extension in http.so, lead to Fatal error: Class 'HttpRequest' not found errors. I believe that the http.so module is no longer loading for one reason or another, but I cannot find any errors indicating the reason.

You could say, "Did you try to undo the new imap setting?" To which I will answer. Yes. I immediately turned off all my configuration changes and deleted the c-client library, and I still cannot get it to work. I thought it was strange ... I did not make any changes that would lead to this issue. Looking at this, I also found that not only did the HTTP extension no longer load, but all my extensions downloaded via php.ini no longer load.

Can someone at least give me some more debugging steps? So far, I have tried to include all errors, including startup errors in my php.ini, which works for other errors, but I do not see startup errors on the command line or via apache. And again, php.ini seems to be parsed, given that if I run php_info (), I get the settings that are in php.ini.

Edit , it seems that only some of the php.ini options are being listened to. Is there any way to check my php.ini?

Edit Edit . It looks like I'm wrong and php.ini is no longer loading. However, if I ran php_info (), I realized that it was looking for its php.ini in the right place.

Edit Edit Edit My configuration is on the path to the configuration file below, but it says that the configuration file is not loaded. WTF permission issue? Currently there are 644, so everyone should be able to read, if not write. I tried to do this 777 and it did not work.

 Configuration File (php.ini) Path /etc/php.ini Loaded Configuration File (none) 

Edit Edit Edit Edit By loading ini on the command line with the -c command, I can run my files and use -m to show that my modules are loading So nothing happened with php.ini

Edit Edit Edit Edit Edit I pointed out to him that my directory ini directory should be by looking for the php.ini file not in the file itself. To do this, I tried the settings of / etc, / etc / and allowed php to set the default directory and then move my ini file to this directory. All is unsuccessful :(

Edit Edit Edit Edit Edit I pointed out to him that my directory ini directory should be by looking for the php.ini file not in the file itself. To do this, I tried the settings of / etc, / etc / and allowed php to set the default directory and then move my ini file to this directory. All failure: (

Edit Edit Edit Edit Edit Edit Additional information, starting the php -ini and ls command line from the directory is indicated in the php settings. Also run with the -c option on the command line, where the execution is successful, and not when I do not enable -c

 j@j :/usr/local/lib$ php -ini | grep Configuration Configuration File (php.ini) Path => /usr/local/lib Loaded Configuration File => (none) Configuration j@j :/usr/local/lib$ ls /usr/local/lib php php.ini python2.5 site_ruby j@j :/usr/local/lib$ php -c /usr/local/lib/php.ini /var/www/toolbelt/test.php j@j :/usr/local/lib$ php /var/www/toolbelt/test.php Fatal error: Class 'HttpRequest' not found in /var/www/toolbelt/test.php on line 7 jonathan@jonathan :/usr/local/lib$ 

Edit Edit Edit Edit Edit Edit Edit Additional information. Using the strace method, shown in another article on stack exchange I, I checked if there were attempts to open the ini file made while loading php. Did not have

 j@j :/usr/local/lib$ sudo strace -e trace=open php -ini 2>&1 |grep php.ini Configuration File (php.ini) Path => /usr/local/lib j@j :/usr/local/lib$ sudo strace -e trace=open php -ini 2>&1 |grep /usr/local/lib Configuration File (php.ini) Path => /usr/local/lib extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20060613 => /usr/local/lib/php/extensions/no-debug-non-zts-20060613 include_path => .:/usr/local/lib/php => .:/usr/local/lib/php 
+4
source share
1 answer

Well, I hope this prevents someone else from banging his head on the wall for several hours.

I found my own solution in the clean building of my php. Turns out you can change the with-config-file-path parameter and change its path in the outputs of phpinfo () and php -ini. HOWEVER, if you do not clean your assembly, the place where the setting is actually used will not be restored and will work on your assembly.

Note to yourself: always clean your assembly. I knew this before, but I was thrown away because rebuild really changes what php tells me that the directory is.

+7
source

Source: https://habr.com/ru/post/1339093/


All Articles