Showing posts with label Install php from source in linux. Show all posts
Showing posts with label Install php from source in linux. Show all posts

Thursday, September 20, 2012

PHP Installation in Linux

 
cd /usr/local/src
wget http://es.php.net/distributions/php-5.4.1.tar.gz
tar -zxvf  php-.5.4.1.tar.gz
cd php-5.4.1

Run the command updatedb

Find the exact path of the Apache extension tool (apxs) using
 locate apxs 


./configure --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/bin/mysql --with-libdir=lib64 --enable-mbstring --with-mcrypt

you can also use --prefix= (to the location you need the php to be installed)

Error
checking libxml2 install dir… /opt/xml2/
checking for xml2-config path…
configure: error: xml2-config not found. Please check your libxml2 installation.

Solution
yum -y install libxml2-devel
Error
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

Solution
yum install libmcrypt
yum install libmcrypt-devel

Error:
configure: error: Cannot find MySQL header files under /usr/bin/mysql.
Note that the MySQL client library is not bundled anymore!


./configure --with-apxs2=/usr/sbin/apxs --with-mysqli=/usr/bin/mysql_config --enable-mbstring --with-mcrypt


make
make install

generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating main/php_config.h
config.status: executing default commands


PHP installed successfully now.

You can check the installed php using:

rpm -qa  | grep -i php

For more details you can check 

./configure --help


######################################################################################