(Originally asked here: http://stackoverflow.com/questions/14977119/problems-installing-php5-from-source-in-ubuntu)
I've been trying to install php5 for a while.
Ubuntu 12.10 Apache 2.4.3
And the version of php I want to install is:
I follow the documentation in the webpage.
I install Apache (after putting the apr and apr-util folders in ./scrlib, just as the documentation says).
sudo ./configure --enable-so sudo make sudo make install
All of these commands output a lot of information, but no error nor warning as long as I'm aware.
Just for the record:
/usr/local/apache2/bin/httpd -l Compiled in modules: core.c mod_so.c http_core.c event.c
mod_so.c is there, so I think the installation were alright.
Now, I attempt to install PHP (after putting the
.sudo ./configure \ --prefix=/home/usr/local/php5/ \ --with-mysql \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-xsl \ --with-gdbm \ --with-gd \ --with-freetype=/usr/include/freetype2/ \ --with-zlib-dir=/usr/include \ --with-ttf \ --with-jpeg-dir=/usr/lib
Everything goes fine except the following warning:
configure: WARNING: unrecognized options: --with-freetype, --with-ttf
However, those options aren't the greatest of my problems and I follow to the next steps.
And these are the lasts lines of the output.
Generating phar.php Generating phar.phar PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. invertedregexiterator.inc pharcommand.inc directorytreeiterator.inc directorygraphiterator.inc clicommand.inc phar.inc Build complete. Don't forget to run 'make test'.
sudo make install
Everything seems fine.
sudo cp php.ini-development /usr/local/lib/php.ini
I edit the conf file (/usr/local/apache2/conf/httpd.conf). The line...
LoadModule php5_module modules/libphp5.so
...was already there. Just under that line I add:
<FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>
I restart apache:
sudo service apache2 restart
So, php5 should be already installed. I make the following script in php.
// info.php <?php phpinfo(); ?>
And saved it in /var/www/info.php
I put the following url in my browser:
There's no output.
In the original question, a user asked me to check the error log (in /var/log/apache2/).
If I browse to my info.php file, the only new line added to the error.log is
[Wed Feb 20 19:49:01 2013] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
Then they asked me to put display_errors = On in php.ini. Nothing was shown on the screen.
Finally they asked me to run php -i in the terminal. The output was the following:
The program 'php' is currently not installed. You can install it by typing: sudo apt-get install php5-cli
What am I missing? The reason that I don't use apt-get install php5 is because I want all the options I've put in the config file. The first thing that gave me problems was that I did not have the gdbm handler for databases. If you know a way in which I can use apt-get install php5 and then somehow add this new option to php5, then I also consider it a solution.