PHP.ini即使存在于配置位置也不会自动加载(PHP.ini does not load automatically even though it exists at the config location)
好吧,这可能只是我对php不够了解,但在这里它。
我在Ubuntu Hardy。 我有一个自定义编译版本的PHP,我用这些参数编译。
./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
我使用命令
pecl install pecl_http
来安装http.so扩展。 它位于我的php.ini的正确模块目录中。 我的php.ini正在加载,我可以在ini中更改内容并影响php。 我在php.ini中包含了extension=http.so
行。这工作得很好。 直到我添加这些编译选项才能添加imap
--with-openssl --with-kerberos --with-imap --with-imap-ssl
哪个失败,因为我需要我通过
apt-get install libc-client-dev
修复的c-client库之后php编译好了,我有工作的imap支持,呜。但是,现在我对HttpRequest的所有调用都是http.so中pecl_http扩展的一部分导致
Fatal error: Class 'HttpRequest' not found
Class'HttpRequestFatal error: Class 'HttpRequest' not found
错误。 我认为http.so模块不再因某种原因而加载,但我找不到任何显示原因的错误。你可能会说“你试过撤消新的imap设置吗?” 我将回答。 是的,我有。 我直接解除了所有配置更改并卸载了c-client库,但仍然无法使其工作。 我觉得这很奇怪......我没有做出任何导致这个问题的改变。 看了之后我还发现不仅http扩展不再加载了,而且我通过php.ini加载的所有扩展都不再加载了。
有人至少可以给我一些进一步的调试步骤吗? 到目前为止,我已经尝试启用所有错误,包括我的php.ini中的启动错误,这些错误适用于其他错误,但我没有在命令行或通过apache看到任何启动错误。 而且,如果我运行php_info(),php.ini似乎正在被解析,我得到了php.ini中的设置。
编辑它似乎只有一些php.ini设置被收听。 有没有办法测试我的php.ini?
编辑编辑似乎我再次弄错了,php.ini根本没有被加载。 但是,如果我运行php_info()我得到它正在寻找我的php.ini在正确的位置。
编辑编辑编辑我的配置位于下面的配置文件路径位置,但它表示没有加载配置文件。 WTF权限问题? 它目前是644,所以如果不写它,每个人都应该能够阅读它。 我尝试将其制作成777,但是没有用。
Configuration File (php.ini) Path /etc/php.ini Loaded Configuration File (none)
编辑编辑编辑编辑通过使用-c命令在命令行上加载ini我可以运行我的文件并使用-m显示我的模块加载因此php.ini没有任何问题
编辑编辑编辑编辑编辑我已经告诉我,我的ini目录配置应该是一个找到php.ini文件的路径而不是文件本身。 为此我尝试了设置/ etc,/ etc /,并让php设置默认目录,然后将我的ini文件移动到该目录中。 都失败了:(
编辑编辑编辑编辑编辑我已经告诉我,我的ini目录配置应该是一个找到php.ini文件的路径而不是文件本身。 为此我尝试了设置/ etc,/ etc /,并让php设置默认目录,然后将我的ini文件移动到该目录中。 都失败了:(
编辑编辑编辑编辑编辑编辑更多信息,php --ini的命令行运行和它在php设置中指向的dir。 也可以在运行成功的命令行上使用-c选项运行,而不是在不包含-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$
编辑编辑编辑编辑编辑编辑编辑更多信息。 利用另一个堆栈交换文章中显示的strace方法,我测试了是否有任何尝试打开加载php中的ini文件。 没有
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
Ok this is probably just me not knowing enough about php but here it goes.
I'm on Ubuntu Hardy. I have a custom compiled version of PHP which I have compiled with these parameters.
./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 have used the command
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 within the ini and effect php. I have included theextension=http.so
line in my php.ini.That worked fine. Until I added these compilation options in order to add imap
--with-openssl --with-kerberos --with-imap --with-imap-ssl
Which failed because I needed the c-client library which I fixed by
apt-get install libc-client-dev
After which php compiles fine and I have working imap support, woo.HOWEVER, now all my calls to HttpRequest which is part of the pecl_http extention in http.so result in
Fatal error: Class 'HttpRequest' not found
errors. I figure the http.so module is no longer loading for one reason or another but I cannot find any errors showing the reason.You might say "Have you tried undoing the new imap setup?" To which I will answer. Yes I have. I directly undid all my config changes and uninstalled the c-client library and I still can't get it to work. I thought that's weird... I have made no changes that would have resulted in this issue. After looking at that I have also discovered that not only is the http extension no longer loading but all my extensions loaded via php.ini are no longer loading.
Can someone at least give me some further debugging steps? So far I have tried enabling all errors including startup errors in my php.ini which works for other errors, but I'm not seeing any startup errors either on command line or via apache. And yet again the php.ini appears to be being parsed given that if I run php_info() I get settings that are in the php.ini.
Edit it appears that only some of the php.ini settings are being listened to. Is there a way to test my php.ini?
Edit Edit It appears I am mistaken again and the php.ini is not being loaded at all any longer. However, If I run php_info() I get that it's looking for my php.ini in the correct location.
Edit Edit Edit My config is at the config file path location below but it says no config file loaded. WTF Permission issue? It is currently 644 so everyone should be able to read it if not write it. I tried making it 777 and that didn't work.
Configuration File (php.ini) Path /etc/php.ini Loaded Configuration File (none)
Edit Edit Edit Edit By loading the ini on the command line using the -c command I am able to run my files and using -m shows that my modules load So nothing is wrong with the php.ini
Edit Edit Edit Edit Edit I have had it pointed out to me that my ini directory config should be a path to find the php.ini file in not the file itself. To this end I have tried settings /etc,/etc/, and letting php set the default directory then moving my ini file into that directory. All fail :(
Edit Edit Edit Edit Edit I have had it pointed out to me that my ini directory config should be a path to find the php.ini file in not the file itself. To this end I have tried settings /etc,/etc/, and letting php set the default directory then moving my ini file into that directory. All fail :(
Edit Edit Edit Edit Edit Edit Further info, command line run of php --ini and ls of dir it points at in the php settings. Also run with -c option on command line where the run succeeds and not when i don't include -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 Further info. Utilizing the strace method shown in another stack exchange article I tested to see if there were any attempts to open the ini file made in the loading of php. There were not
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
原文:https://stackoverflow.com/questions/4950941