简体   繁体   English

sudo pecl install apc返回错误

[英]sudo pecl install apc returns error

I run the command: sudo pecl install apc 我运行命令: sudo pecl install apc

The file gets downloaded, the configuration succeeds, then make is launched and I get the following error. 文件下载,配置成功,然后make启动,我得到以下错误。

/usr/include/php5/ext/pcre/php_pcre.h:29: fatal error: pcre.h: No such file or directory

Is there a way to fix it? 有办法解决吗?

PCRE is a dependency for installing APC. PCRE是安装APC的依赖项。 You can install it pretty quick with 你可以很快安装它

yum install pcre-devel or apt-get install libpcre3-dev yum install pcre-develapt-get install libpcre3-dev

once it's installed, re-run 一旦安装完毕,重新运行

sudo pecl install apc

sudo apt-get install libpcre3-dev is the answer. sudo apt-get install libpcre3-dev就是答案。

So to be able to install pecl [install extension] 所以能够安装pecl [安装扩展]

the following packages are required: 需要以下包:

sudo apt-get install php5-pear php5-dev libpcre3-dev

What version of PHP? 什么版本的PHP?

For a while, some months ago, I had trouble installing APC, and could only make it work with pecl install apc-beta 有一段时间,几个月前,我在安装APC时遇到了麻烦,并且只能使用pecl install apc-beta

If you're not dealing with a production system, you might try that. 如果您没有处理生产系统,您可以试试。

Have you install a PHP extension via PECL before? 您之前是否通过PECL安装了PHP扩展?

Does the file /usr/include/php5/ext/pcre/php_pcre.h actually exist? 文件/usr/include/php5/ext/pcre/php_pcre.h是否确实存在?

You could get this error because of the following 由于以下原因,您可能会收到此错误

  1. Incorrect permissions 权限不正确
  2. PECL directory configuration is incorrect. PECL目录配置不正确。

You seem to be missing the development version of PHP5. 你似乎错过了PHP5的开发版本。 On Ubuntu you can install it using: 在Ubuntu上,您可以使用以下命令安装它:

sudo aptitude install php5-dev

I have posted an answer for the same here . 我在这里发布了相同的答案。 But I am still posting here for reference 但我仍然在这里发帖以供参考

To include pcre.h file, search the package archives for the pcre.h file. 要包含pcre.h文件,请在软件包存档中搜索pcre.h文件。 To do this I use a command called apt-file ( 为此,我使用一个名为apt-file的命令(

apt-get install apt-file apt-get install apt-file

and

apt-file update apt-file更新

if you don't have it installed). 如果你没有安装它)。 Then search for the pcre package: 然后搜索pcre包:

apt-file search -x "/pcre.h$" apt-file search -x“/pcre.h$”

The -x informs the command that I want to use a regular expression as the pattern. -x通知命令我想使用正则表达式作为模式。 apt-file provided me with three hits: apt-file为我提供了三个点击:

  • kannel-dev: /usr/include/kannel/gwlib/pcre.h kannel-dev:/usr/include/kannel/gwlib/pcre.h
  • libajax6-dev: /usr/include/ajax/pcre.h libajax6-dev:/usr/include/ajax/pcre.h
  • libpcre3-dev: /usr/include/pcre.h libpcre3-dev:/usr/include/pcre.h

The last one is the one I want: 最后一个是我想要的那个:

apt-get install libpcre3-dev apt-get install libpcre3-dev

This will solve the problem with pcre.h file compilation problem. 这将解决pcre.h文件编译问题。 Hope it will help others, who may come to find an answer to this thread. 希望它能帮助其他人,他们可能会找到这个帖子的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM