about me about me
photography photography
software projects software projects
contact me contact me

I needed to compile the latest PHP5 from source so I could enable FPM support. The following packages needed installing to successfully complete compilation. My configure line was as follows:

'./configure' '--prefix=/etc/php' '--with-config-file-path=/etc/php' '--with-curl' 
'--with-pear' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' 
'--with-xpm-dir' '--with-freetype-dir' '--with-t1lib' '--with-mcrypt' '--with-mhash' 
'--with-mysql' '--with-mysqli' '--with-pdo-mysql' '--with-openssl' '--with-xmlrpc' 
'--with-xsl' '--with-bz2' '--with-gettext' '--with-fpm-user=www-data' 
'--with-fpm-group=www-data' '--enable-fpm' '--enable-exif' '--enable-wddx' 
'--enable-zip' '--enable-bcmath' '--enable-calendar' '--enable-mbstring' 
'--enable-soap' '--enable-sockets' '--enable-sqlite-utf8' '--enable-shmop' 
'--enable-dba' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm'

I’m not sure I even needed all of these extensions but it looked good. More painful was finding out which packages needed installing, to summarise:

sudo apt-get install libxml2-dev libbz2-dev libcurl4-gnutls-dev libpng12-dev 
libjpeg62-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libmhash-dev 
libxslt1-dev

PHP5 should compile successfully. All the error messages I stumbled across along the way:

configure: error: xml2-config not found. Please check your libxml2 installation.
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
    easy.h should be in /include/curl/
configure: error: libjpeg.(a|so) not found.
configure: error: libXpm.(a|so) not found.
configure: error: freetype.h not found.
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

comments

Aravinda // 30.May.2011 // 06:34

Use

sudo apt-get build-dep php5

to install all the dependency packages required to build php.

Julian // 03.Jul.2011 // 03:02

That’s a useful command Aravinda, but have you tried it? On my machine it wanted to install 109 new packages, including lmsensors, fancontrol, a large collection of perl modules and a huge bunch of other stuff that doesn’t seem useful for PHP.

Greg K // 20.Jul.2011 // 21:31

The irony is I performed this on my Ubuntu VM that I develop on before deploying to this server. Last night I bypassed this compile from source step by upgrading Ubuntu to 10.10 from 10.04 LTS, then I could take the easy route and use the package manager to install PHP-FPM.

I’m saving a chunk of memory running nginx with PHP-FPM vs Apache 2. Now if I can port WordPress from MySQL to sqlite3 …

RD // 27.Jan.2012 // 22:12

Thanks for saving me a bunch of time — I got to “configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.” when I found that little gem.

Mark Beeby // 04.May.2012 // 13:21

Whilst I wait for my “make test” to finish (even a decent EC2 instance takes an age), I thought i’d say thank you, it’s blog posts like this that save so much time for everyone else.

Bart McLeod // 11.Jan.2013 // 09:26

Hi, thanks for your post, but hey, everybody says you’re saving them time and I find my self in a similar position as you, that is, I got to the “configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.” part, with no clues on how to solve it. I faced almost every other error you listed and had to upgrade lots of other stuff. What I’m trying to do is compile php5.4.10 to work with MAMP. They do not yet provide the correct sources, otherwise, it would be easy. The version number of their server components is behind the actual server and so are the php version in the components. So I download the source directly from php.net and compiled all the depencies up the point where t1lib doesn’t seem to be correct. However, macports can clean and reinstall t1lib without reporting any problems. The error remains. Anyone any clues except installing something pre-built? I know I can install Zend Server for example, but I would like to master this compiling from source karma thing.

Luis // 03.Jun.2013 // 23:34

sudo apt-get install libt1-dev worked for me Bart

Jeff Parsons // 09.Aug.2013 // 14:15

Just ran into some similar issues (building from scratch on MacOSX, so no apt-get help) and thought I’d pass along the libt1 details I found (and successfully used to build php-fpm from php-5.4.15 sources.

- Dug up http://www.t1lib.org/ through some searches. (Was very annoyed about how obvious that URL was after the fact.)
- That linked to ftp://sunsite.unc.edu/pub/Linux/libs/graphics/ which then had a t1lib-5.1.2.tar.gz available
- unzip; ./configure;make;make install and all was happy