install php from source

From WebHostingNeeds.com
Jump to: navigation, search

Set lib path

cat /etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
echo "/usr/lib" >> /etc/ld.so.conf
cat /etc/ld.so.conf
ldconfig

Install libxml2

http://xmlsoft.org/downloads.html

cd /usr/local/src
wget ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz
tar -zxvf libxml2-git-snapshot.tar.gz
cd libxml2-*
./configure
make
make install

OR

yum install libxml2-devel -y

Install zlib

http://www.zlib.net/

cd /usr/local/src
wget http://www.gzip.org/zlib/zlib-1.2.3.tar.gz
tar -zxvf zlib-1.2.3.tar.gz
cd /usr/local/src/zlib-1.2.3
make clean
./configure --prefix=/usr/local
make
make install

Install libpng

http://www.libpng.org/pub/png/libpng.html

cd /usr/local/src
wget http://softlayer.dl.sourceforge.net/project/libpng/00-libpng-stable/1.2.40/libpng-1.2.40.tar.gz
tar -zxvf libpng-1.2.40.tar.gz
cd libpng-*
./configure
make check
make install

Install freetype

http://sourceforge.net/projects/freetype/files/freetype2/

cd /usr/local/src
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.11.tar.gz
tar zxvf freetype-2.4.11.tar.gz
cd freetype-*
./configure --prefix=/usr/local
make
make install

Install libjpeg

http://freshmeat.net/projects/libjpeg/

http://www.ijg.org/

cd /usr/local/src
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar zxvf jpegsrc.v7.tar.gz
cd jpeg-*
./configure
make
make install-lib

Install libgd

http://www.libgd.org/Main_Page

cd /usr/local/src
wget http://www.libgd.org/releases/gd-latest.tar.gz
tar -zxvf gd-latest.tar.gz
cd /usr/local/src/gd-*
./configure --with-png=/usr/local --with-jpeg=/usr/local --without-x --with-freetype=/usr/local
make && make install

Install curl

http://curl.haxx.se/

cd /usr/local/src
wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
tar -zxvf curl-7.19.6.tar.gz
cd curl-7*
./configure
make
make install

Install mhash

http://mhash.sourceforge.net/

cd /usr/local/src
wget http://kent.dl.sourceforge.net/sourceforge/mhash/mhash-0.9.9.9.tar.gz
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-*
./configure --prefix=/usr/local
make
make install


Install mcrypt

http://sourceforge.net/projects/mcrypt

instal libmcrypt

cd /usr/local/src
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd /usr/local/src/libmcrypt-2.5.8
./configure --prefix=/usr/local
make
make install

install mcrypt

cd /usr/local/src
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/mcrypt-2.6.8.tar.gz
tar -pxzf mcrypt-2.6.8.tar.gz
cd /usr/local/src/mcrypt-2.6.8
./configure --prefix=/usr/local
make
make install

usr bin ld cannot find lltdl


Install tidy

http://tidy.sourceforge.net/

yum -y install libtidy-devel tidy


Install php

cd /usr/local/src
wget http://in2.php.net/get/php-5.2.10.tar.gz/from/us.php.net/mirror
tar -zxvf php-5.2.10.tar.gz
cd /usr/local/src/php-5*
make clean && make distclean
./configure --prefix=/usr --with-config-file-path=/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --enable-ftp  --enable-calendar --enable-bcmath --enable-sockets --with-zlib --enable-magic-quotes --with-curl --with-gd --with-jpeg-dir=/usr/local --enable-mbstring --with-freetype-dir=/usr/local --with-mhash=/usr/local --enable-exif --with-mcrypt=/usr/local  --with-tidy=/usr
make
make install


BASIC

./configure --prefix=/usr --with-config-file-path=/etc --with-apxs2=/etc/httpd/bin/apxs --with-mysql=/usr  --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --with-xml --enable-ftp  --enable-calendar --enable-bcmath --enable-sockets --enable-track-vars --with-zlib --enable-magic-quotes

With CURL

./configure --prefix=/usr --with-config-file-path=/etc --with-apxs2=/etc/httpd/bin/apxs --with-mysql=/usr  --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --with-xml --enable-ftp  --enable-calendar --enable-bcmath --enable-sockets --enable-track-vars --with-zlib --enable-magic-quotes --with-curl

mkdir /usr/local/lib/mysql
cd /usr/local/lib/mysql
ln -s /usr/include/mysql include
ln -s /usr/lib64/mysql lib

./configure --prefix=/usr/local/apache/php --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local/lib/mysql  --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --enable-ftp  --enable-calendar --enable-bcmath --enable-sockets --enable-track-vars --with-zlib --enable-magic-quotes --with-gd --with-jpeg=/usr/local


/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start


cp php.ini-recommended /etc/php.ini

Modify httpd.conf

vi /usr/local/apache/conf/httpd.conf


As CGI - Add at end

AddType application/x-httpd-php php
AddType application/x-httpd-php-source phps


As Module

LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
AddHandler php5-script .php
AddType text/html .php


Finish

After installing PHP, you need to restart apache

service httpd restart


----------------------------------------------------------------------------------------------
configure: error: xpm.h not found.
----------------------------------------------------------------------------------------------
cd /usr/local/src
wget http://koala.ilog.fr/ftp/pub/xpm/xpm-3.4k.tar.gz
tar -zxvf xpm-3.4k.tar.gz
cd xpm-3.4k


----------------------------------------------------------------------------------------------
Compile PHP
----------------------------------------------------------------------------------------------


rpm -q --filesbypkg gd

---------------------------------------------------------------
GD JPEG SUPPORT
---------------------------------------------------------------

# find / -name libjpeg.*
/usr/local/src/jpeg-6b/libjpeg.a
/usr/local/src/jpeg-6b/libjpeg.doc
/usr/lib/libjpeg.so.62
/usr/lib/libjpeg.so.62.0.0
#

ln -s /usr/lib/libjpeg.so.62.0.0 /usr/lib/libjpeg.so

[[email protected] php-5.2.1]# ls -l /usr/local/lib/libj*
-rw-r--r--    1 root     root       191740 Feb 10 12:27 /usr/local/lib/libjpeg.a
[[email protected] php-5.2.1]#


--with-jpeg-dir=/usr/local/lib

---------------------------------------------------------------


./configure --prefix=/usr/local --with-config-file-path=/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext --with-gdbm --with-xml --enable-ftp  --enable-calendar --enable-bcmath --enable-sockets --enable-track-vars --with-zlib --enable-magic-quotes --with-gd --with-jpeg-dir=/usr/local/lib --enable-mbstring --with-curl


make; make install
service httpd restart
make clean



cd /usr/local/src/php-4.4.2/ext/gd/libgd/
vi gd_jpeg.c

FIND :

#include "jpeglib.h"
#include "jerror.h"

REPLACE :

include "/usr/local/src/jpeg-6b/jpeglib.h"
include "/usr/local/src/jpeg-6b/jerror.h"

include "../jpeg-6b/jpeglib.h"
include "../jpeg-6b/jerror.h"


[[email protected] ~]# find / -name jpeglib.h
/usr/local/src/jpeg-6b/jpeglib.h
[[email protected] ~]#


-----------------------------------------------------------------------------------

checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.


Solution
--------

--with-mysql=/usr/local/mysql

-----------------------------------------------------------------------------------