php “找不到 config.m4。” 在使用 pecl 安装 apd 时运行 phpize
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24612979/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Cannot find config.m4." while running phpize in the installation of apd using pecl
提问by Anthony
I'm trying to get access to rename_function
in PHP, and for that I need PECL APD. I'm running Ubuntu 14.04 LTS.
我正在尝试使用rename_function
PHP访问,为此我需要 PECL APD。我正在运行 Ubuntu 14.04 LTS。
I'm trying to run sudo pecl install apd
, but I'm getting:
我正在尝试运行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
Should I be running this command from a certain directory?
我应该从某个目录运行这个命令吗?
This time I tried it with verbose options turned on, in case there is a clue in the logs:
这次我尝试打开详细选项,以防日志中有线索:
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
回答by balintpekker
This will be a short summary of everything to is a precondition to run APD as a PHP profiler, I hope it will help your needs. This summary applies for PHP 5.6.2 APD 1.0.1 and might be incorrect for other versions.
这将是将 APD 作为 PHP 分析器运行的先决条件的所有内容的简短摘要,我希望它能帮助您的需求。此摘要适用于 PHP 5.6.2 APD 1.0.1,对于其他版本可能不正确。
First of all do not start it if you didn't ensure these two:
首先,如果您没有确保这两个,请不要启动它:
- Deactivate Zend platform or any other PHP optimizer. In general you need to disable all Zend extensions.
- Install a debugging enabled version of PHP (
--enable-debug
)
- 停用 Zend 平台或任何其他 PHP 优化器。通常,您需要禁用所有 Zend 扩展。
- 安装启用调试的 PHP 版本 (
--enable-debug
)
If you have a working PEAR setup you need to setup APD like in thisarticle. Don't forget to try out distribution packages either. Otherwise APD's build as following:
如果你有一个工作PEAR安装你需要设置APD像这样的文章。也不要忘记尝试分发包。否则 APD 的构建如下:
- Extract tarball.
- Change directory in tarball.
- Run
<apache root>/bin/phpsize
- Run
./configure
(Add--with-php-config=<apache root>/bin/php-config
if configure fails.) - Compile and install everything using
make make install
- Edit php.ini and add at least
zend_extension=/apd.so apd.statement=1 apd.tracedir=/tmp/apd-traces
- Create the output directory specified in php.ini
- 提取压缩包。
- 更改 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中指定的输出目录
Now you'll need to restart Apache but before you do, check that the APD extension works fine. To do simply run PHP
现在您需要重新启动 Apache,但在此之前,请检查 APD 扩展是否正常工作。只需运行 PHP
/bin/php
No warning should be given if extension is loaded properly. If you get error message something like the "apd.so" extension couldn't be loaded there is a problem. Check if you compiled against the correct Apache/PHP version and using the same right now.
如果扩展正确加载,则不应发出警告。如果您收到类似“apd.so”扩展无法加载的错误消息,则说明有问题。检查您是否针对正确的 Apache/PHP 版本进行编译并立即使用相同的版本。
If PHP doesn't complain about anything enter:
如果 PHP 没有抱怨任何内容,请输入:
<?php phpinfo(); ?>
and check for some lines about APD. If you find them you are done.
并检查有关 APD 的一些行。如果你找到它们,你就完成了。
You'll also need some traces so to start tracing you need to your Apache to allow the PHP module to load APD. Next you'll need to identify the script to trace. Add the APD call at the top of the script:
您还需要一些跟踪,以便开始跟踪您需要到 Apache 以允许 PHP 模块加载 APD。接下来,您需要确定要跟踪的脚本。在脚本顶部添加 APD 调用:
apd_set_pprof_trace();
Then make some requests and remove the statement again to avoid causing further harm.
Now have a look at the trace directory. You should find files with a naming scheme of pprof[0-9]*.[0-9]
here. Decode them using the pprofp
tool from your APD source tarball. Example:
然后提出一些请求并再次删除该语句以避免造成进一步的伤害。现在看看跟踪目录。您应该找到命名方案为pprof[0-9]*.[0-9]
here 的文件。使用pprofp
来自 APD 源 tarball的工具对它们进行解码。例子:
/bin/php /pprofp -u
Redirect stdout if necessary. Use -t instead of -u (summary output) to get calling trees. When you create traces with -t you get a summary output too, but it doesn't contain the per-call durations. I suggest to always create both a call tree and a summary trace.
如有必要,重定向标准输出。使用 -t 而不是 -u(摘要输出)来获取调用树。当您使用 -t 创建跟踪时,您也会得到一个摘要输出,但它不包含每次调用的持续时间。我建议始终创建调用树和摘要跟踪。
Hope that helps, I recommend youhardly to read the link mentioned above.
希望帮助,我建议你很难阅读上面的链接提到。
EDIT:
编辑:
The phpize command is meant to be run at the top level of an extension source dir (this source dir should contain a file name config.m4). See thisfor more info.
phpize 命令旨在在扩展源目录的顶层运行(此源目录应包含文件名 config.m4)。有关更多信息,请参阅此内容。
回答by kenorb
As per error:
根据错误:
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 user
如果命令失败,
phpize: not found
那么你需要安装 php5-dev 包。您可以通过
apt-get install php5-dev
以 root 用户身份运行来完成
I think you should install module development for PHP via:
我认为您应该通过以下方式为 PHP 安装模块开发:
sudo apt-get install php5-dev
This should provide you with phpize
binary necessary to compile the Pecl extension sources. And make sure it's in your PATH
.
这应该为您提供phpize
编译 Pecl 扩展源所需的二进制文件。并确保它在您的PATH
.