“找不到config.m4。”在使用pecl安装apd时运行phpize

时间:2014-07-07 14:27:10

标签: php pecl

我正在尝试访问PHP中的rename_function,为此我需要PECL APD。我正在运行Ubuntu 14.04 LTS。

我正在尝试运行sudo pecl install apd,但我得到了:

downloading apd-1.0.1.tgz ...
Starting to download apd-1.0.1.tgz (36,643 bytes)
..........done: 36,643 bytes
15 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of
the module

If the command failed with 'phpize: not found' then you need to install php5-dev package. You can do it by running 'apt-get install php5-dev' as a root userERROR: `phpize' failed

我应该从某个目录运行此命令吗?

这次我尝试打开详细选项,以防日志中出现线索:

sudo /usr/bin/pecl -vvvvv install apd
Warning: file_exists(): Unable to find the wrapper "channel" - did you forget to enable it when you configured PHP? in PEAR/Downloader/Package.php on line 1518

Warning: is_file(): Unable to find the wrapper "channel" - did you forget to enable it when you configured PHP? in PEAR/Downloader/Package.php on line 1528

Warning: is_file(): Unable to find the wrapper "channel" - did you forget to enable it when you configured PHP? in PEAR/Downloader/Package.php on line 1528
Downloading "http://pecl.php.net/get/apd-1.0.1.tgz"
downloading apd-1.0.1.tgz ...
Starting to download apd-1.0.1.tgz (36,643 bytes)
..........done: 36,643 bytes
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/LICENSE /usr/share/php/doc/apd/.tmpLICENSE
adding to transaction: chmod 664 /usr/share/php/doc/apd/.tmpLICENSE
adding to transaction: rename /usr/share/php/doc/apd/.tmpLICENSE /usr/share/php/doc/apd/LICENSE
adding to transaction: installed_as LICENSE /usr/share/php/doc/apd/LICENSE /usr/share/php/doc /apd
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/README /usr/share/php/doc/apd/.tmpREADME
adding to transaction: chmod 664 /usr/share/php/doc/apd/.tmpREADME
adding to transaction: rename /usr/share/php/doc/apd/.tmpREADME /usr/share/php/doc/apd/README
adding to transaction: installed_as README /usr/share/php/doc/apd/README /usr/share/php/doc /apd
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/pprofp /usr/bin/.tmppprofp
+ chmod +x /usr/bin/.tmppprofp
adding to transaction: chmod 775 /usr/bin/.tmppprofp
adding to transaction: rename /usr/bin/.tmppprofp /usr/bin/pprofp
adding to transaction: installed_as pprofp /usr/bin/pprofp /usr/bin /
+ cp /tmp/pear/temp/tmpNUpEpz/apd-1.0.1/pprof2calltree /usr/bin/.tmppprof2calltree
+ chmod +x /usr/bin/.tmppprof2calltree
adding to transaction: chmod 775 /usr/bin/.tmppprof2calltree
adding to transaction: rename /usr/bin/.tmppprof2calltree /usr/bin/pprof2calltree
adding to transaction: installed_as pprof2calltree /usr/bin/pprof2calltree /usr/bin /
15 source files, building
building in /tmp/pear/temp/pearf7LGca
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

If the command failed with 'phpize: not found' then you need to install php5-dev packageYou can do it by running 'apt-get install php5-dev' as a root userrolling back 12 file operations
+ rm /usr/share/php/doc/apd/.tmpLICENSE
+ rm /usr/share/php/doc/apd/.tmpREADME
+ rm /usr/bin/.tmppprofp
+ rm /usr/bin/.tmppprof2calltree
ERROR: `phpize' failed

Warning: unlink(/tmp/glibctestRdKE0K): No such file or directory in System.php on line 214

Warning: unlink(/tmp/pear/temp/pearf7LGca): No such file or directory in System.php on line 214

1 个答案:

答案 0 :(得分:16)

这将是将APD作为PHP分析器运行的前提条件的简短摘要,我希望它能满足您的需求。此摘要适用于PHP 5.6.2 APD 1.0.1,可能对其他版本不正确。

如果你不确定这两个,首先不要启动它:

  • 停用Zend平台或任何其他PHP优化器。通常,您需要禁用所有Zend扩展。
  • 安装启用调试版的PHP(--enable-debug

如果你有一个有效的PEAR设置,你需要像this文章中那样设置APD。不要忘记尝试分发包。否则APD的构建如下:

  • 提取tarball。
  • 更改tarball中的目录。
  • 运行<apache root>/bin/phpsize
  • 运行./configure(如果配置失败,请添加--with-php-config=<apache root>/bin/php-config。)
  • 使用编译和安装所有内容
    make
    make install
    
  • 编辑php.ini并添加至少
    zend_extension=/apd.so
    apd.statement=1
    apd.tracedir=/tmp/apd-traces
    
  • 创建php.ini
  • 中指定的输出目录

现在您需要重新启动Apache,但在此之前,请检查APD扩展是否正常工作。只需运行PHP

即可
/bin/php

如果正确加载扩展程序,则不应发出警告。如果您收到错误消息,例如无法加载“apd.so”扩展名,则会出现问题。检查您是否针对正确的Apache / PHP版本编译并立即使用相同的版本。

如果PHP没有抱怨任何输入:

<?php phpinfo(); ?>

并查看有关APD的一些信息。如果你发现它们就完成了。

您还需要一些跟踪,以便开始跟踪您需要Apache以允许PHP模块加载APD。接下来,您需要确定要跟踪的脚本。在脚本顶部添加APD调用:

apd_set_pprof_trace();

然后发出一些请求并再次删除该声明以避免造成进一步的伤害。 现在看一下trace目录。您应该在此处找到命名方案为pprof[0-9]*.[0-9]的文件。使用APD源代码tarball中的pprofp工具对其进行解码。例如:

/bin/php /pprofp -u 

如有必要,重定向标准输出。使用-t而不是-u(摘要输出)来获取调用树。使用-t创建跟踪时,也会获得摘要输出,但不包含每次调用的持续时间。我建议始终创建一个调用树和一个摘要跟踪。

希望有帮助,我建议你几乎阅读上面提到的链接

编辑:

phpize命令应在扩展源dir的顶层运行(此源目录应包含文件名config.m4)。有关详细信息,请参阅this