Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to compile PHP from source and install it to work with apache2. I followed this tutotial. When i tried ./configure --prefix=/usr/local/apache --enable-so, I got:

configure error - apr not found apr-util not found..

After i installed both of these I started getting a new error:

configure: error: pcre-config for libpcre not found.

Whats the solution for this? Is there a better and easy way of building PHP from source?

share|improve this question

migrated from stackoverflow.com Jun 22 '10 at 19:28

This question came from our site for professional and enthusiast programmers.

2  
Why you explicitly want to build it from source? –  Sander Pham Jun 22 '10 at 19:22
1  
You have to keep going; anyway, you will probably only need to do it once. –  Artefacto Jun 22 '10 at 19:27
    
what php version do you want to build? –  Elzo Valugi Jun 22 '10 at 19:27
4  
This is called Dependency hell; the "solution" is to use a package manager instead of building from source, that's pretty much the whole reason they were created –  Michael Mrozek Jun 22 '10 at 19:27
    
When did compiling source code stop being a programming issue? –  John Gardeniers Jun 22 '10 at 23:47

3 Answers 3

So, what is the problem? Install Apache-Portable-Runtime (apr) and its util file. Also pcre-devel or pcre-dev package. Compile again... see if you are missing anything else.

Make the compiler happy by installing whatever is missing.

-N

share|improve this answer

One trick you can use to help you build packages from source on debian-based systems is to look at the source package page for the official package. For the lucid php5 see this page (http://packages.ubuntu.com/source/lucid/php5). As you scroll down on that page you can see a list of all the build dependencies for the official package. To build the package yourself you are probably going to need to install everything in that list before you will be able to perform compile the source using a similar set of configuration options. If you are recompiling because you want some features disabled you may be able to skip some of the things in the list.

Here is the Build-Depends for the official package. This will probably tell you exactly what all you n eed. This is from the this file http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_5.3.2-1ubuntu4.dsc

Build-Depends: apache2-prefork-dev, autoconf (>=2.63), automake (>=1.11) | automake1.11, bison, 
  chrpath, debhelper (>=5), flex, freetds-dev, hardening-wrapper, libapr1-dev (>=1.2.7-8), 
  libbz2-dev, libcurl4-openssl-dev, libdb-dev (>=4.7) | libdb4.8-dev | libdb4.6-dev, 
  libenchant-dev, libexpat1-dev (>=1.95.2-2.1), libfreetype6-dev, libgcrypt11-dev, 
  libgd2-xpm-dev, libglib2.0-dev, libgmp3-dev, libicu-dev, libjpeg-dev | libjpeg62-dev, 
  libkrb5-dev, libldap2-dev, libmhash-dev (>=0.8.8), libmysqlclient-dev, libpam0g-dev, 
  libpcre3-dev (>=6.6), libpng12-dev, libpq-dev, libpspell-dev, librecode-dev, libsasl2-dev, 
  libsnmp-dev, libsqlite0-dev, libsqlite3-dev, libssl-dev, libt1-dev, libtidy-dev, 
  libtool (>=2.2), libwrap0-dev, libxmltok1-dev, libxml2-dev, libxslt1-dev (>=1.0.18), netbase, 
  quilt, re2c, unixodbc-dev, zlib1g-dev, libedit-dev, tzdata

If you are just enabling a particular option it may be far easier to just grab the package source for your distro-release and tweak the rules/control file and rebuild the package. If you need a newer version you might check to see if a newer release is in the unstable branch and try back-porting it.

share|improve this answer

You need to install the appropriate libraries and, sometimes, their include files and link libraries.

Try this (this is for Debian lenny, but may also work for you):

sudo aptitude install libpcre3 libapr1 libaprutil1

(In this case, apparently the -dev versions are not necessary; I don't have them installed in a machine where I build PHP from source)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.