首页 \ 问答 \ PHP.ini即使存在于配置位置也不会自动加载(PHP.ini does not load automatically even though it exists at the config location)

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'HttpRequest Fatal 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 the extension=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
更新时间:2022-06-30 12:06

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)