PHP扩展的命令行(CLI)加载,但不加载阿帕奇 [英] PHP extension loaded in command line (cli) but not loaded by apache

查看:278
本文介绍了PHP扩展的命令行(CLI)加载,但不加载阿帕奇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最后更新。

问题解决了。

我的方式解决的问题是重新安装从源代码通过以下链接指令后完全Apache和PHP。

The way I solve the problem is re-install Apache and PHP entirely from source following the instruction by the following link.

http://dan.drydog.com/apache2php.html

然后,通过构建直接进行延伸扩展到PHP的指令后
下面的链接了。

Then do the extension by build the extension directly into PHP following the instruction by the link down below.

的唯一一件事就是二进制文件都只是在特定的路径,我认为这是要解决,虽然一个简单的问题。

The only thing is that the binaries are all only in the specific path, which I think is a easy problem to solve though.

谢谢大家,这是我第一次#1和后我花了一整天,使我的第一个PHP扩展。虽然有点艰难,但我喜欢它! :D

Thanks everyone, this is my first post in Stackoverflow and I spend one whole day to make my first php extension. Though a little bit tough, but I like it! :D

原始的问题

我试图建立一个PHP扩展通过以下链接指令以下内容:

I'm trying to build a php extension following the instruction by the following link:

http://docstore.mik.ua/orelly/webprog/php/ ch14_03.htm

我通过以下步骤构建扩展ROT13进入PHP

I build the extension of 'rot13' into the php using the following steps

./buildconf
./configure --enable-rot13
make
sudo make install

然后我测试通过命令行PHP扩展。输出是完全一样的上述文章。

Then I tested the extension by the command line php. The output is exactly the same as the above article.

我想后,我打造的扩展名改成PHP本身,我并不需要关心php.ini文件。然后,我尝试测试浏览器的延伸,我发现其实phpinfo()函数的页面不显示有关新的扩展任何事物,而PHP -m命令显示了我的扩展被加载。我查了日志的Apache2,没有错误。

I suppose after I build the extension into php itself, I don't need to care about the php.ini file. Then I try to test the extension in the browser, I find out that the phpinfo() page doesn't show any thing about the new extension whereas php -m command shows my extension is loaded. I checked the apache2 log, there is no error.

我用Google搜索了将近一天,并没有得到线索。有些线程都在计算器但没有真正的解决方案的工作类似。

I googled for nearly one day and got no clue. Some threads are similar in stackoverflow but no real working solutions.

我的系统是Ubuntu的11.10和PHP 5.3.10和apache2.2.20。

My system is Ubuntu 11.10 and php 5.3.10 and apache2.2.20.

如果你们有线索,请帮助。谢谢!

If you guys have clues, please help. Thanks!

更新:

我也把延长= rot13.so在php.ini文件在/etc/php5/apache2/php.ini路径,但现在每当我重新启动的Apache2服务器时,我得到了下面的错误。

I did put the extension=rot13.so in the php.ini file at the path of /etc/php5/apache2/php.ini but now whenever I restart the apache2 server, I got the following error.

PHP Warning:  PHP Startup: rot13: Unable to initialize module
Module compiled with build ID=API20090626,TS,debug
PHP compiled with build ID=API20090626,NTS

这些选项需要未知匹配在线0

These options need to match in Unknown on line 0

任何人有什么引起这种故障的任何线索?

Any one has any clue about what caused this fault?

顺便说一句,当我编译的延长,我没有使用的./configure --enable-ROT13 --with-PHP-配置=的/ usr / local / bin目录/ PHP的配置,以确保它使用的配置文件PHP的。

BTW, when I compile the extension, I did use the ./configure --enable-rot13 --with-php-config=/usr/local/bin/php-config to make sure it uses the configuration file of php.

再次更新:

我发现,在phpinfo()函数从该网页有不同版本的PHP -i我在命令行中得到的...真奇怪是什么?我会尝试谷歌如何计算出这个矛盾。

I find out that the phpinfo() from the web page has different version of php -i I get from the command line... How strange is that? I'll try to google how to figure out this conflict.

推荐答案

在Ubuntu中,有2个的php.ini文件,一个CLI和一个用于Apache的。

In Ubuntu, there are 2 php.ini files, one for CLI and one for apache.

在默认情况下,它们都位于 /etc/php5/cli/php.ini /etc/php5/apache2/php.ini

By default, they are located at /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini.

在你的情况,你需要启用Apache2的php.ini文件扩展名了。

In your case, you need to enable the extension in apache2 php.ini file too.

这篇关于PHP扩展的命令行(CLI)加载,但不加载阿帕奇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆