pcre.h: No such file or directory when installing APC (PHP extension)

After a complete reinstall of Ubuntu 10.04 on my laptop I had to recreate my development environment. Part of that included installing some extensions from PECL. When trying to install apc-3.1.2 I got the following error:

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

I decided to search the package archives for the pcre.h file. To do this I used a command called apt-file (apt-get install apt-file and apt-file update if you don’t have it installed).

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

Now that I finally have this package I can run pear install pecl/apc-3.1.2 to install APC.

This entry was posted in PHP, Technology and tagged , , , , , , , . Bookmark the permalink.

50 Responses to pcre.h: No such file or directory when installing APC (PHP extension)

  1. Vulpes says:

    For Fedora/yum based systems this did the trick: sudo yum install pcre-devel

  2. LornaJane says:

    I got exactly the same error installing oauth from pecl on ubuntu – grabbing the libpcre3-dev package from aptitude solved my issues, thanks for the post!

  3. nickweavers says:

    Had same problem as LornaJane. Many thanks for posting this!

  4. Patrick says:

    Thank you so much – libpcre3-dev did the trick doing apc-3.1.5 on Ubuntu server 10.10 as well.

  5. Azeem Michael says:

    @Vulpes thanks for the info

  6. Nate Eagle says:

    I love finding exactly the answer I needed via a quick Google search. Thanks for documenting your solution, you’ve helped me out!

  7. IliasK says:

    Thank you so much for documenting that! I can confirm that this does the trick for Ubuntu 8.04 (Hardy) too.
    I am a newcomer in Ubuntu and you taught me a way to resolve missing files problems, as well.

  8. scr3amW says:

    me too, exactly the same problem, worked like a charm, thx very much…

  9. syndrael says:

    Thanks for this efficient post.
    Best regards from Paris,France

  10. David says:

    Thanks for this. Vulpes comment was the solution to my problem with a Centos install.

  11. gavin says:

    Thank you, this helped me with Debian.

  12. hannes0812 says:

    This step was necessary with a freshly baked Ubuntu 11.04 as well where LAMP was installed via “tasksel”.


  13. null_radix says:

    nice tip thanks

  14. God at play says:

    Thanks! This fixed my failed install process for W3 Total Cache on a LEMP system.

  15. Max says:

    thanx for sharing this information, saved alot of time!

  16. Dennis says:

    thanx, i got this error when pecl installing oauth…
    the error got me right to this place, with the answer :)

  17. gubatron says:

    Thank you for sharing, I got this error trying to install pecl on Debian.

  18. Taras Kozlov says:

    Got this problem on Ubuntu 11 and your solution helped to resolve it. Thank you!

  19. Skw33d says:

    Thanks you ! ;) It’s ever cool to get a response fastly in Google because guys like you share their problems

  20. Sorted me right out. Thanks!

  21. You beautiful person ;-) oauth now installed.

  22. Erik says:

    Thanks a ton!

  23. Just in time for help. Thank you. You are a good man.

  24. Shavais says:

    Sweet, finally a tool that tells me what’s in a package without requiring that it be installed, and even finds packages for me, that are available but not installed, that contain files matching a regex. Very nice. Thanks for the tip.

  25. Elliot says:


  26. Varinen says:

    Thank you for the tip, saved me some time!

  27. gpasci says:

    thank you!!

  28. dudu2me says:


  29. DarkStar1 says:

    Thanks very much. Solution work on ubuntu 12.04. Anyone wanting to follow the steps should be aware that you need to install apt-file to be able to perform the file search.

  30. Iqbal says:

    Thank You..this is very useful

  31. Jacob says:

    thanks. real time saver!

  32. tester says:

    tnx, save my live

  33. urmel says:

    tnx, that saved my day !

  34. Jeremy Byrne says:


  35. Gary says:

    You the man, thanks

  36. QUOCKYCLUNC says:

    keep it up admin.I’ve learned a lot from your blog here.already bookmarked.thanks for your share.

  37. Synexis says:

    People like you make the world a better place. Thanks for sharing your solution!

  38. tim says:

    Thank you!

  39. Henry says:

    Same problem here.. this fix solved it.. thanks for the post!

  40. Barrett says:

    Thank you for this, saved me a good bit of time!

  41. Marty says:

    Thanks, This was a great find Google and one click and here is the answer. For those on Centos 5, the yum install comment by Vulpes works.

  42. Pingback: XE 를 예로 들어 우분투에서 APC 설치 및 복제DB개념 및 캐싱관련 설명. | BUYWORKSELL

  43. foobar says:

    Thanks for sharing, exactly the answer I needed!

  44. Rix Beck says:

    Thanks! Very useful!

  45. Foobr says:

    Thank you

  46. Pingback: XE 를 예로 들어 우분투에서 APC 설치 및 복제DB개념 및 캐싱관련 설명. | BUY-WORK-SELL (사고팔고 일하고 ...)

  47. sungguh akur dengan kalian saya yakin bakalan opini anda sangat cakap dan juga membahagiakan dan risalah anda bonafit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s