php5.4 Archives - David Yin's Blog https://www.yinfor.com/tag/php5-4 Tech geek. Life geek. Sun, 11 Jun 2023 03:59:17 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 https://www.yinfor.com/wp-content/uploads/2016/09/cropped-icon-120x120.png php5.4 Archives - David Yin's Blog https://www.yinfor.com/tag/php5-4 32 32 Install XCache 3.1.0 from souce on PHP 5.4.28 https://www.yinfor.com/2014/05/install-xcache-3-1-0-from-souce-on-php-5-4-28.html https://www.yinfor.com/2014/05/install-xcache-3-1-0-from-souce-on-php-5-4-28.html#respond Mon, 26 May 2014 16:28:41 +0000 https://www.yinfor.com/?p=3778 I have a staging server. I have installed php5.3, 5.4, and 5.5 on it. Today I tried to install XCache 3.1.0 on it with PHP 5.4.28. First, I recompiled the PHP 5.4.28 with more features. So noted below: 1) Install...

The post Install XCache 3.1.0 from souce on PHP 5.4.28 appeared first on David Yin's Blog.

]]>
I have a staging server. I have installed php5.3, 5.4, and 5.5 on it. Today I tried to install XCache 3.1.0 on it with PHP 5.4.28.

First, I recompiled the PHP 5.4.28 with more features. So noted below:

1) Install additional required dev packages

yum install gmp gmp-devel

2) Compile and install php 5.4.28

cd php-5.5.12
./configure --prefix=/usr/local/php54 \
    --with-config-file-path=/etc/php54 \
    --with-config-file-scan-dir=/etc/php54/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 \
    --enable-cgi \
    --enable-exif \
    --enable-zip \
    --with-gmp \
    --enable-ftp \
    --enable-shmop \
    --enable-sockets
make
make install

Restart Apache

service httpd restart

Then, I start to install XCache from source, the latest version of XCache is 3.1.0.

3) Download and decompress it.

wget http://xcache.lighttpd.net/pub/Releases/3.1.0/xcache-3.1.0.tar.gz
tar -xvzf xcache-3.1.0.tar.gz

4) Compile XCache based on current PHP 5.4.28 installation

cd xcache-3.1.0
/usr/local/php54/bin/phpize
./configure --enable-xcache --with-php-config=/usr/local/php54/bin/php-config
make
make install
cp xcache.ini /etc/php54/php.d/xcache.ini
service httpd restart

Then reload the phpinfo page and get following information.

web2-php54-fastcgi-withxcache

And XCache web interface:

xcache-3.1.0-php5.4.28

The post Install XCache 3.1.0 from souce on PHP 5.4.28 appeared first on David Yin's Blog.

]]>
https://www.yinfor.com/2014/05/install-xcache-3-1-0-from-souce-on-php-5-4-28.html/feed/ 0
Install Multiple Version of PHP on CentOS 6.5 as Fastcgi https://www.yinfor.com/2014/05/install-multiple-version-of-php-on-centos-6-5-as-fastcgi.html https://www.yinfor.com/2014/05/install-multiple-version-of-php-on-centos-6-5-as-fastcgi.html#comments Sat, 24 May 2014 23:11:31 +0000 https://www.yinfor.com/?p=3769 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 post Install Multiple Version of PHP on CentOS 6.5 as Fastcgi appeared first on David Yin's Blog.

]]>
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

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.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

wget http://us1.php.net/get/php-5.5.12.tar.gz/from/this/mirror
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 \
    --enable-cgi
make 
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 web1.example.com

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

#!/bin/sh
PHPRC=/etc/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
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 web1.example.com

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

<VirtualHost *:80>
  ServerName web1.example.com
  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
    </Directory>
  </IfModule>

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

</VirtualHost>

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.

<?php
phpinfo();
?>

6) In Browser, you can see following infomation page.
web1-php55-fastcgi

 

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

http://us1.php.net/get/php-5.4.28.tar.gz/from/this/mirror

web2.example.com

/usr/local/php54

/etc/php54

user web2

group web2

web2-php54-fastcgi

 

7.2) php 5.3.28

http://us1.php.net/get/php-5.3.28.tar.gz/from/this/mirror

web3.example.com

/usr/local/php53

/etc/php53

user web3

group web3

web3-php53-fastcgi

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.

The post Install Multiple Version of PHP on CentOS 6.5 as Fastcgi appeared first on David Yin's Blog.

]]>
https://www.yinfor.com/2014/05/install-multiple-version-of-php-on-centos-6-5-as-fastcgi.html/feed/ 4
Do you still need Xcache when you have PHP Opcache https://www.yinfor.com/2014/03/do-you-still-need-xcache-when-you-have-php-opcache.html https://www.yinfor.com/2014/03/do-you-still-need-xcache-when-you-have-php-opcache.html#respond Mon, 03 Mar 2014 16:14:59 +0000 https://www.yinfor.com/?p=3432 This VPS is running with PHP 5.4.25.  Zend OPcache is a built-in module in PHP 5.4.25. I have Xcache installed before. Today, I removed it and just use OPcache. When I use Xcache and Opcache at the same time. And...

The post Do you still need Xcache when you have PHP Opcache appeared first on David Yin's Blog.

]]>
This VPS is running with PHP 5.4.25.  Zend OPcache is a built-in module in PHP 5.4.25.

I have Xcache installed before. Today, I removed it and just use OPcache.

When I use Xcache and Opcache at the same time. And config Database cache and object cache to use opcode:Xcache. I found the Xcache doesn’t help me a lot. See screenshot below.

xcache

PHP scripts are not cached in Xcache entirely.  I thought Zend OPcache is working on php scripts.

Here are another screenshot of Zend OPcache.

opcache703

So, I removed Xcache and restart Apache web server. Then test the web page performance at webpagetest.org. The load speed is almost same and nothing wrong without it.

I changed the W3TC configuration. Database cache method and Object cache method are changed to Disk.

 

 

The post Do you still need Xcache when you have PHP Opcache appeared first on David Yin's Blog.

]]>
https://www.yinfor.com/2014/03/do-you-still-need-xcache-when-you-have-php-opcache.html/feed/ 0
Rebuild server and make it even faster https://www.yinfor.com/2014/02/rebuild-server-and-make-it-even-faster.html https://www.yinfor.com/2014/02/rebuild-server-and-make-it-even-faster.html#respond Tue, 25 Feb 2014 16:10:51 +0000 https://www.yinfor.com/?p=3411 This blog is running fast compared with other blogs I saw, but I rebuild the server and make it even faster. The Load time of home is decreased from 1.858 second to 1.219 second, or 34%. The technology used on...

The post Rebuild server and make it even faster appeared first on David Yin's Blog.

]]>
This blog is running fast compared with other blogs I saw, but I rebuild the server and make it even faster.
The Load time of home is decreased from 1.858 second to 1.219 second, or 34%.

The technology used on the new installation listed below:

  • Centos 6.5 64bit
  • Apache as backend server
  • php 5.4
  • Varnish as front cache server
  • MariaDB database server
  • Proftp Ftp server.

webpage-result-varnish

 

The very general steps to rebuild server.

  1. Backup mysql database and all files of site
  2. Rebuild Server on VPS panel
  3. Update packages
  4. Add EPEL, REMI, MariaDB repo (enable REMI repo)
  5. Install MariaDB, and run mysql_secure_installation
  6. Install Apache PHP
  7. Install PHP modules
  8. Install Varnish
  9. Config Varnish to use 80 port
  10. Config Apache to use 8080 port
  11. Restore database, and restore files.

 

 

The post Rebuild server and make it even faster appeared first on David Yin's Blog.

]]>
https://www.yinfor.com/2014/02/rebuild-server-and-make-it-even-faster.html/feed/ 0
PHP 5.5 vs PHP 5.4 vs PHP 5.3 – phpBB 3 https://www.yinfor.com/2013/09/php_55_vs_php_54_vs_php_53_-_p.html https://www.yinfor.com/2013/09/php_55_vs_php_54_vs_php_53_-_p.html#comments Tue, 03 Sep 2013 12:49:02 +0000 https://www.yinfor.com/?p=1205 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,...

The post PHP 5.5 vs PHP 5.4 vs PHP 5.3 – phpBB 3 appeared first on David Yin's Blog.

]]>
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.

net-panel-php55

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:

PHP 5.3
542.2ms

PHP 5.4 with OPcache
516ms

PHP 5.5 with OPcache
514ms


It is 5% faster when using PHP 5.4 or PHP 5.5.

PHP 5.5 is almost same as PHP 5.4 on loading time.

The post PHP 5.5 vs PHP 5.4 vs PHP 5.3 – phpBB 3 appeared first on David Yin's Blog.

]]>
https://www.yinfor.com/2013/09/php_55_vs_php_54_vs_php_53_-_p.html/feed/ 1