//
you're reading...
Uncategorized

PHP 5.5 Installation (source code) on CentOS Linux

PHP 5.5 Installation (source code) on CentOS Linux

Pre-Requests
Install Apache Httpd
Install MySQL Database Server

Operation System
CentOS Linux 6.7 x86_64

Apache Httpd version
Apache Httpd 2.2.23

Software Packages required

PHP php-5.5.28.tar.gz
autoconf autoconf-2.69.tar.gz
FreeType freetype-2.6.tar.gz
JPEG jpeg-9a
JPEGSRC jpegsrc.v9a.tar.gz
GD libgd-gd-2.1.1.tar.gz
LIBCRYPT libmcrypt-2.5.8.tar.gz
LIBPNG libpng-1.5.23.tar.gz
LIBXML2 libxml2-2.9.2.tar.gz
ZLIB zlib-1.2.8.tar.gz
PHPMyAdmin phpMyAdmin-4.4.13.1-all-languages.tar.gz
Zend ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz

Step1) Unpack required software package

[root@LXTESTWIKI01 ~]# tar -xvzf autoconf-2.69.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf bison-3.0.4.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf freetype-2.6.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf libgd-gd-2.1.1.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf jpegsrc.v9a.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf libmcrypt-2.5.8.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf libpng-1.5.23.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf libxml2-2.9.2.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf zlib-1.2.8.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
[root@LXTESTWIKI01 ~]# tar -xvzf phpMyAdmin-4.4.13.1-all-languages.tar.gz

Step2) Install the PHP software

#libxml2
[root@LXTESTWIKI01 PHP_Installation]# cd libxml2-2.9.2
[root@LXTESTWIKI01 libxml2-2.9.2]# ./configure --prefix=/usr/local/libxml2
[root@LXTESTWIKI01 libxml2-2.9.2]# make && make install

#libmcrypt
[root@LXTESTWIKI01 PHP_Installation]# cd libmcrypt-2.5.8
[root@LXTESTWIKI01 libmcrypt-2.5.8]# ./configure --prefix=/usr/local/libmcrypt
[root@LXTESTWIKI01 libmcrypt-2.5.8]# make
[root@LXTESTWIKI01 libmcrypt-2.5.8]# make install

#zlib
[root@LXTESTWIKI01 PHP_Installation]# cd zlib-1.2.8
[root@LXTESTWIKI01 zlib-1.2.8]# ./configure
[root@LXTESTWIKI01 zlib-1.2.8]# make
[root@LXTESTWIKI01 zlib-1.2.8]# make install

#libpng
[root@LXTESTWIKI01 PHP_Installation]## cd libpng-1.5.23
[root@LXTESTWIKI01 libpng-1.5.23]# ./configure --prefix=/usr/local/libpng
[root@LXTESTWIKI01 libpng-1.5.23]# make
[root@LXTESTWIKI01 libpng-1.5.23]# make install

#jpeg
[root@LXTESTWIKI01 PHP_Installation]# mkdir -p /usr/local/jpeg9
[root@LXTESTWIKI01 PHP_Installation]# mkdir -p /usr/local/jpeg9/bin
[root@LXTESTWIKI01 PHP_Installation]# mkdir -p /usr/local/jpeg9/lib
[root@LXTESTWIKI01 PHP_Installation]# mkdir -p /usr/local/jpeg9/include
[root@LXTESTWIKI01 PHP_Installation]# mkdir -p /usr/local/jpeg9/man/man1

[root@LXTESTWIKI01 PHP_Installation]# cd jpeg-9a
[root@LXTESTWIKI01 jpeg-9a]# ./configure --prefix=/usr/local/jpeg9/ --enable-shared --enable-static
[root@LXTESTWIKI01 jpeg-9a]# make
[root@LXTESTWIKI01 jpeg-9a]# make install

#freetype
[root@LXTESTWIKI01 PHP_Installation]# cd freetype-2.6
[root@LXTESTWIKI01 freetype-2.6]# ./configure --prefix=/usr/local/freetype
[root@LXTESTWIKI01 freetype-2.6]# make
[root@LXTESTWIKI01 freetype-2.6]# make install

#autoconf
[root@LXTESTWIKI01 PHP_Installation]# cd autoconf-2.69
[root@LXTESTWIKI01 autoconf-2.69]# ./configure
[root@LXTESTWIKI01 autoconf-2.69]# make && make install

#bison
[root@LXTESTWIKI01 PHP_Installation]# cd bison-3.0.4
[root@LXTESTWIKI01 bison-3.0.4]# ./configure
[root@LXTESTWIKI01 bison-3.0.4]# make
[root@LXTESTWIKI01 bison-3.0.4]# make install

#gd
[root@LXTESTWIKI01 PHP_Installation]# cd libgd-gd-2.1.1/src
[root@LXTESTWIKI01 src]# vi gd_png.c
# #include “png.h” change to #include “/usr/local/libpng/include/png.h”
[root@LXTESTWIKI01 src]# cd ..
[root@LXTESTWIKI01 libgd-gd-2.1.1]# ./bootstrap.sh
[root@LXTESTWIKI01 libgd-gd-2.1.1]# ./configure \
--prefix=/usr/local/gd2/ \
--enable-m4_pattern_allow \
--with-zlib=/usr/local/zlib/ \
--with-jpeg=/usr/local/jpeg6/ \
--with-png=/usr/local/libpng/ \
--with-freetype=/usr/local/freetype/

[root@LXTESTWIKI01 libgd-gd-2.1.1]# make
[root@LXTESTWIKI01 libgd-gd-2.1.1]# make install

Step3) Install PHP

[root@LXTESTWIKI01 ~]# yum install libXpm        
[root@LXTESTWIKI01 ~]# yum install libXpm-devel

[root@LXTESTWIKI01 ~]# tar -xvzf php-5.5.28.tar.gz
[root@LXTESTWIKI01 ~]# cd php-5.5.28
[root@LXTESTWIKI01 php-5.5.28]# ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql/ \
--with-libxml-dir=/usr/local/libxml2/ \
--with-png-dir=/usr/local/libpng/ \
--with-jpeg-dir=/usr/local/jpeg9/ \
--with-freetype-dir=/usr/local/freetype/ \
--with-gd=/usr/local/gd2/ \
--with-zlib-dir=/usr/local/zlib/ \
--with-mcrypt=/usr/local/libmcrypt/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-xpm-dir=/usr/lib \
--enable-soap  \
--enable-mbstring=all \
--enable-sockets

[root@LXTESTWIKI01 php-5.5.28]# make
[root@LXTESTWIKI01 php-5.5.28]# make install

Step4) Post Installation Configuration

[root@LXTESTWIKI01 php-5.5.28]# cp php.ini-production /usr/local/php/php.ini
[root@LXTESTWIKI01 php-5.5.28]# cd /usr/local/php
[root@LXTESTWIKI01 php-5.5.28]# vi php.ini

chang the short_open_tag = Off to short_open_tag = On in php.ini

[root@LXTESTWIKI01 php-5.5.28]# vi /usr/local/apache/conf/httpd.conf

Add the line ‘LoadModule php5_module modules/libphp5.so’, if it don’t exist!

Insert the follow contents

AddType application/x-httpd-php .php
DirectoryIndex index.html index.php

Here is an sample of the httpd.conf


ServerRoot "/usr/local/apache"

Listen 80

#LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
#LoadModule asis_module modules/mod_asis.so
#LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_default_module modules/mod_authn_default.so
#LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_default_module modules/mod_authz_default.so
#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule imagemap_module modules/mod_imagemap.so
#LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
#LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule status_module modules/mod_status.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule php5_module        modules/libphp5.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>

User apache
Group www

</IfModule>
</IfModule>

ServerAdmin you@example.com
ServerName 10.40.1.189:80 

DocumentRoot "/usr/local/apache/htdocs"

<Directory />
    Options -Indexes
    #Options FollowSymLinks
    AllowOverride None
    #Require all granted
    Order allow,deny
    Allow from all
</Directory>

<Directory "/usr/local/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<FilesMatch "^\.ht">
    #Order allow,deny
    #Deny from all
    Satisfy All
</FilesMatch>

ErrorLog "logs/error_log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access_log" common

</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock
</IfModule>

<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>

    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php

</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Setup the index.php on /usr/local/apache/htdocs/index.php, insert the contents

<?
phpinfo();
?>

Save and Quit, :wq

Start the Apache Httpd Server

[root@LXTESTWIKI01 php-5.5.28]# /usr/local/apache/bin/httpd -k start
Advertisements

About daviewning

I am an Oracle DBA

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: