Currently Viewing Posts Tagged php5.3

Install Multiple Version of PHP on CentOS 6.5 as Fastcgi

It is a guide of how to install multiple version of PHP on CentOS 6.5 64bit. All different PHP as fastcgi.
It is works on Apache, one web server, each virtualhost has its own different php version support.

0) Prepare the testing environment

Disable SELinux and stop iptables. It is for testing environment. For production machine, you should implement firewall carefully.

setenforce 0
service iptables stop

1) Enable rpmforge and epel yum repository

rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh epel-release-6-8.noarch.rpm

2) Install required dev packages and Apache, mod_fcgid

yum install gcc libxml2-devel bzip2-devel zlib-devel \
    curl-devel libmcrypt-devel libjpeg-devel \
    libpng-devel gd-devel mysql-devel
yum install httpd mod_fcgid 

3) Create the system startup links for Apache and start it:

chkconfig --levels 235 httpd on
/etc/init.d/httpd restart 

4) Compile and install php 5.5.12

tar -xvzf mirror
cd php-5.5.12
./configure --prefix=/usr/local/php55 \
    --with-config-file-path=/etc/php55 \
    --with-config-file-scan-dir=/etc/php55/php.d \
    --with-libdir=lib64 \
    --with-mysql \
    --with-mysqli \
    --enable-mbstring \
    --disable-debug \
    --disable-rpath \
    --with-bz2 \
    --with-curl \
    --with-gettext \
    --with-iconv \
    --with-openssl \
    --with-gd \
    --with-mcrypt \
    --with-pcre-regex \
    --with-zlib \
make install
mkdir /etc/php55
cp php.ini-production /etc/php55/php.ini

Edit php.ini

vi /etc/php55/php.ini

Add the following in the end of the file

cgi.fix_pathinfo = 1

Restart Apache

service httpd restart

5) Creating Vhosts For

5.1) Create user and group

groupadd web1
useradd -s /bin/false -d /var/www/web1 -m -g web1 web1
chmod 755 /var/www/web1

5.2) Then we create the document roots and make them owned by the users/groups web1:

mkdir -p /var/www/web1/web
chown web1:web1 /var/www/web1/web

5.3) We will run PHP using suExec; suExec’s document root is /var/www, as the following command shows:

[root@localhost ~]# /usr/sbin/suexec -V
 -D AP_DOC_ROOT="/var/www"
 -D AP_GID_MIN=100
 -D AP_HTTPD_USER="apache"
 -D AP_LOG_EXEC="/var/log/httpd/suexec.log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=500
 -D AP_USERDIR_SUFFIX="public_html"

5.4) create the wrapper scripts in subdirectories of /var/www/php-fcgi-scripts

mkdir -p /var/www/php-fcgi-scripts/web1
vi /var/www/php-fcgi-scripts/web1/php-fcgi-starter

Enter following into php-fcgi-starter

export PHPRC
exec /usr/local/php55/bin/php-cgi

5.5) The php-fcgi-starter scripts must be executable, and they (and the directories they are in) must be owned by the web site’s user and group:

chmod 755 /var/www/php-fcgi-scripts/web1/php-fcgi-starter
chown -R web1:web1 /var/www/php-fcgi-scripts/web1

5.6) Create Vhost for

vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot /var/www/web1/web/

  <IfModule mod_fcgid.c>
    SuexecUserGroup web1 web1
    <Directory /var/www/web1/web/>
      Options +ExecCGI
      AllowOverride All
      AddHandler fcgid-script .php
      FCGIWrapper /var/www/php-fcgi-scripts/web1/php-fcgi-starter .php
      Order allow,deny
      Allow from all

  # ErrorLog /var/log/apache2/error.log
  # CustomLog /var/log/apache2/access.log combined
  ServerSignature Off


Restart Apache

service httpd restart

5.7) Now we create a small PHP test file

vi /var/www/web1/web/info.php

Add following content into it.


6) In Browser, you can see following infomation page.


7) Compile and install php 5.4.28 and php 5.3.28

Repeat the step 4, 5, and 6. Just change something respect to php 5.4.28 and php5.3.28.

7.1) php 5.4.28



user web2

group web2



7.2) php 5.3.28



user web3

group web3


Then, I have three hosts on the same one Apache web server at CentOS 6.5 64bit server.

Each host has its own php version installed, from 5.3 to 5.5.

So, you can use the above as a template.

Performance between PHP5.3.3 and PHP5.5.12

I installed PHP5.3.3 and PHP5.4.28 at the same time in one VirtualBox guest OS.

Basic information.

  • Host OS: Windows 7 Ultimate 64bit
  • VirtualBox 4.3.12
  • Guest OS: CentOS 6.5 64bit with 512MB base memory
  • PHP5.3.3 is installed as mod_php
  • PHP5.5.12 is installed as php-fpm with mod_fastcgi


Run PHP BENCHMARK SCRIPT to get the total time.


The total time of PHP 5.3.3 is 6.746 seconds.


The total time of PHP 5.5.12 is 5.628 seconds.

I  repeated the test many times. The average difference is 85%. On the other words, PHP 5.5 spend 1 second less than PHP 5.3.



Replace PHP 5.3.3 by PHP 5.5.3

I have a test before to compare the performance of PHP 5.5 and PHP 5.3. The result is PHP 5.5 is 20% faster.

Now, I replaced PHP 5.3.3 by PHP 5.5.3 at this server, which my blog is on.

The php -v information shown as below:

PHP 5.5.3 (cli) (built: Aug 24 2013 10:14:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

Continue reading “Replace PHP 5.3.3 by PHP 5.5.3”

PHP 5.5 vs PHP 5.4 vs PHP 5.3 – phpBB 3

It is a test on a virtual box Centos 6.4 installation. One forum, powered by phpBB 3.0.11.
I would like to know the time to generate the page.
The time I got is through Firebug on Firefox.
On Firefox 23.0.1, Firebug 1.12.0, Net Panel > All
The waiting time 476ms is the time waiting for the response from web server.
From my point of view it is the time including generate the html.


Which program I tesed on?

phpBB 3.0.11, with file as acm_type. It is a forum viewing page, listing topics of one forum.

How to test PHP and get the results?

I tested seven times on each PHP version. Then took the highest one and lowest one away. Add the five waiting time figures and get the average of it.

Let us see the comparison:

Continue reading “PHP 5.5 vs PHP 5.4 vs PHP 5.3 – phpBB 3”

How to install SugarCRM ce on Dreamhost

Here is the guide to show you how to install SugarCRM Community Edition on Dreamhost share hosting plan.

Step 1:
Set up a new domain, subdomain, or folder for Sugar.

Step 2:
Set up a new MySQL database in Dreamhost Web Panel. Write down the mysql host name, user name, password and database name.

Step 3:
Download the latest Community Edition of SugarCRM. It is free version. Then, unzip into a folder such as /home/yourUserName/

Continue reading “How to install SugarCRM ce on Dreamhost”

  • Archives