Cài PHP 5.5 trên CentOS 6.4 Plesk
I always use the
PHP mysql native driver aka mysqlnd when I develop something serious in PHP. Because of many reasons, both of
performance and software design nature.
I’ve learned the hard way that the trio
mysqlnd – CentOS 6 – PHP 5.3 is never a happy story, unless you have a system administrator sitting around to compile
PHP 5.3 with the mysqlnd option in configure command every time you setup another web server. I don’t want to go further to other implications, to be honest I hate being logged in as root and I try to make my visits as short as possible. Sometimes
I wonder how sysadmins can like their job.
So, I took a leap of faith, I
upgraded all my servers to CentOS 6.4 and I
installed PHP 5.5 which ships with
mysqlnd and did all the management with
yum. Sweet.
It is a bit trickier than it seems though. The default
PHP that ships with
CentOS 6.4 is
PHP 5.3.
So, to make a long story short, from this point I will assume that you are logged in as root or you have root privileges (you are in the sudoers file, call it whatever you want).
By running the following commands:
you solve all dependency issues with
epel and
remi on
CentOS 6.
Then, by running the following command, you install
PHP 5.5.
Trích dẫn:
|
yum --enablerepo=remi,remi-test install httpd php php-common
|
For extra goodies, you can run the following command:
Trích dẫn:
|
yum --enablerepo=remi,remi-test install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
|
EDIT:
It seems that something changed with the remi repo since I installed PHP 5.5 last time. The command that installs PHP 5.5 currently is the following:
Trích dẫn:
|
yum --enablerepo=remi,remi-php55 install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
|
Now, restart your httpd service and set it to boot automatically:
Trích dẫn:
|
service httpd restart chkconfig --levels 235 httpd on
|
Now run:
php --version to see whether the correct version of PHP was installed.
Also, go ahead and create a phpinfo(); file in the root of your webserver to see whether mysqlnd is now activated along with other features.
Don’t forget to
add a rule to your firewall if this is missing.
Trích dẫn:
|
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
|
Tham khảo: http://blog.ahughes.org/?p=717