Compiling PHP Source on Ubuntu 14.04: Common Errors and Solutions
This guide walks through setting up a LAMP environment on Ubuntu 14.04, cloning the PHP source, configuring and building it, and provides a comprehensive list of compilation errors with step‑by‑step commands to resolve each dependency issue.
This article documents the process of compiling PHP from source on an Ubuntu 14.04 server that already has a LAMP development environment installed. It starts by ensuring required tools are present, then clones the PHP repository, configures a minimal build, and runs the compilation.
Prerequisites
Install Git: sudo apt-get install git -y Clone the source and install build tools:
git clone https://github.com/php/php-src.git
cd php-src
sudo apt-get install build-essential
./buildconf
./configure --disable-all # minimal PHP for testing
make
./sapi/cli/php -v # -v shows version if build succeededCommon compilation errors and their solutions
Missing libxml2
configure: error: xml2-config not found. Please check your libxml2 installation.Solution: apt-get install libxml2-dev Missing MySQL client libraries
/usr/bin/mysql_config: No such file or directorySolution:
apt-get install mysql-server mysql-client libmysqlclient-devPEAR compatibility warnings
Warning: Declaration of PEAR_Installer::download() should be compatible with & PEAR_Downloader::download($params) ...These are warnings; they can be ignored or resolved by updating PEAR packages.
Missing OpenSSL headers configure: error: Cannot find OpenSSL's Solution: apt-get install libssl-dev Missing BZip2
checking for BZip2 in default path… not found
configure: error: Please reinstall the BZip2 distributionSolution: apt-get install libbz2-dev Missing libcurl headers
configure: error: Please reinstall the libcurl distribution – easy.h should be in /include/curl/Solution: apt-get install libcurl4-openssl-dev Missing JPEG library configure: error: jpeglib.h not found. Solution: apt-get install libjpeg-dev Missing PNG library configure: error: png.h not found. Solution: apt-get install libpng12-dev Missing FreeType configure: error: freetype-config not found. Solution: apt-get install libfreetype6-dev Missing mcrypt
configure: error: mcrypt.h not found. Please reinstall libmcrypt.Solution: apt-get install libmcrypt-dev Missing pspell configure: error: Cannot find pspell Solution: apt-get install libpspell-dev Missing PEAR PHP_Archive
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.Solution: pear install pear/PHP_Archive Missing recode.h
configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt.Solution: apt-get install librecode-dev After addressing each missing dependency, re‑run ./configure and make until the build completes successfully.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
php Courses
php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
