Quickly so to speak I have noticed this topic around, I have searched and there are plenty of solutions. However these solutions do not work for me, not only that but I'm intending to learn more about the Debian based OS.
- I would like to know how to upgrade PHP 5.3 to PHP 5.4.7 compiling it from source myself without using a third-party PPA.
- Is the way (explained below) the correct way of configuring PHP 5.4? I'm new to compiling from source.
I run Ubuntu Server 12.04 64-bit. I've currently got:
- PHP 5.3
I initially installed PHP 5.3 using
apt-get. I now wish to upgrade to PHP 5.4 due to the advantage of traits in OOP and the struct with arrays and all the other recent patches and such.
I've seen this ondrej/ppa repository, which I refuse to use, given the fact that it may work, but it's an unknown/untrusted source. Also, I'm not learning how to administer from source, using configure, make and install accordingly.
I've seen a solution compiling from source, which is essentially how I was hoping to go about it with some guidance.
I didn't just expect to be spoon-fed and I went out and did some manual reading and at least started the ball rolling myself; this is how far I've got.
The first thing I did was su into root (to save typing sudo all the darn time).
$ sudo su
The next thing I did was download the latest version of PHP (5.4.7) and extracted its' contents ready to configure before installing it.
$ mkdir php5-new && cd !$ $ wget -O php-5.4.7.tar.bz2 http://php.net/get/php-5.4.7.tar.bz2/from/uk3.php.net/mirror $ bzip2 -d php-5.4.7.tar.bz2 $ tar xvf php-5.4.7.tar.gz $ cd php-5.4.7 $ ./configure --help
Finally I decided to have a bash, I looked through the list of options and decided I needed to list ALL of the things I wanted to include in the configuration.
$ ./configure --with-mysql --with-apache2 --with-libxml --with-openssl --with-zlib --with-bz2 --with-curl --with-dom --with-gd --with-imap --with-imap-ssl --with-mcrypt --with-mysqli --with-pdo-mysql --with-libxml --enable-ftp --enable-mbstring --enable-soap
Finally, the results...
When the configuration process had finished, it threw an error:
configure: error: xml2-config not found. Please check your libxml2 installation.
Progress Update (Solution)
The accepted answer turns out to be the solution. For anyone who may bump into this question in the future, I'll add a few additional tips (extending what "Ladadadada" stated below).
I bumped into another issue with OpenSSL, so I had to install the dev libraries; I did this using:
$ apt-cache search openssl | grep dev $ apt-get install libssl-dev $ dpkg -L openssl
Then I set
--with-openssl=/usr/includes/openssl which moaned about an evp.h. I tried to locate this file using
find / -type f -name evp.h and discovered it inside the
/usr/includes/openssl/evp.h directory and so I again removed