51

I run the command: sudo pecl install apc

The file gets downloaded, the configuration succeeds, then make is launched and I get the following error.

/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?

msanford
  • 11,803
  • 11
  • 66
  • 93
Nicolas de Fontenay
  • 2,170
  • 5
  • 26
  • 51

6 Answers6

100

PCRE is a dependency for installing APC. You can install it pretty quick with

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

once it's installed, re-run

sudo pecl install apc

Robert Ros
  • 1,526
  • 11
  • 22
Chris Henry
  • 11,914
  • 3
  • 30
  • 31
  • 2
    PCRE is required but [the docs](http://nl.php.net/manual/en/apc.requirements.php) still say: "No external libraries are needed to build this extension." – Robert Ros Jul 13 '11 at 13:34
  • 1
    `sudo apt-get install build-essential` may help with the external libraries issue. – Citricguy Jul 01 '13 at 11:43
12

sudo apt-get install libpcre3-dev is the answer.

So to be able to install pecl [install extension]

the following packages are required:

sudo apt-get install php5-pear php5-dev libpcre3-dev
Nicolas de Fontenay
  • 2,170
  • 5
  • 26
  • 51
3

What version of PHP?

For a while, some months ago, I had trouble installing APC, and could only make it work with pecl install apc-beta

If you're not dealing with a production system, you might try that.

timdev
  • 61,857
  • 6
  • 82
  • 92
1

Have you install a PHP extension via PECL before?

Does the file /usr/include/php5/ext/pcre/php_pcre.h actually exist?

You could get this error because of the following

  1. Incorrect permissions
  2. PECL directory configuration is incorrect.
Cobby
  • 5,273
  • 4
  • 28
  • 41
1

You seem to be missing the development version of PHP5. On Ubuntu you can install it using:

sudo aptitude install php5-dev
John P
  • 15,035
  • 4
  • 48
  • 56
0

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. To do this I use a command called apt-file (

apt-get install apt-file

and

apt-file update

if you don’t have it installed). Then search for the pcre package:

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

The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:

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

The last one is the one I want:

apt-get install libpcre3-dev

This will solve the problem with pcre.h file compilation problem. Hope it will help others, who may come to find an answer to this thread.

Community
  • 1
  • 1
stackMonk
  • 1,033
  • 17
  • 33