mcrypt, php 5.3 on centos 5.
發表於 : 2012-06-15 17:05:19
http://osc.co.cr/2011/04/mcrypt-php-5-3-on-centos-5/
We have an ancient centos 5 machine hosting this blog and some other php sites. This machine actually does quite a few things, so upgrading to something more recent would be a non-trivial task.
In the course of installing wordpress last week I tried out several extensions. One or more of them ( I forget which just now ) required php 5.3. Hmm, I thought. A reason to upgrade. Hopefully somebody has made yum packages available. As it turns out, I was in luck.
Andy Thomson of webtatic.com has created Centos 5.3.6 RPMs and fully documented the install process. Thanks Andy!
I followed his directions and quickly had php 5.3 installed.
Somehow I missed the installation of the mcrypt extension however, and encountered problems with a couple of sites that use it.
Long story short, if you have followed Andy’s directions above, then all you need to do to install mcrypt is:
$ sudo yum --enablerepo=webtatic install php-mcrypt
Obtuse reader that I am, I initially installed mcrypt the manual and trickier way. In a nutshell, this involves grabbing the php source code from php.net and building the mcrypt extension. I document it here just in case it is useful for someone in a similar situation. The same basic process would work for any standard php extension.
Retrieve and uncompress the PHP source code
1
2
3
$ wget http://us3.php.net/get/php-5.3.6.tar.bz ... net/mirror
$ tar -xjf php-5.3.6.tar.bz2
$ cd php-5.3.6/ext/mcrypt/
Install some required development libraries
$ sudo yum install libmcrypt-devel php-devel
Setup extension for this system.
$ phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
1
2
3
$ ./configure && make
$ sudo make install
$ sudo vi /etc/php.d/mcrypt.ini
Enter the following text:
; Enable mcrypt extension module
extension=mcrypt.so
Test that it is loaded properly by php:
$ php -r "phpinfo();" | grep "mcrypt support"
mcrypt support => enabled
$ sudo /etc/init.d/httpd configtest
Syntax OK
$ sudo /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
We have an ancient centos 5 machine hosting this blog and some other php sites. This machine actually does quite a few things, so upgrading to something more recent would be a non-trivial task.
In the course of installing wordpress last week I tried out several extensions. One or more of them ( I forget which just now ) required php 5.3. Hmm, I thought. A reason to upgrade. Hopefully somebody has made yum packages available. As it turns out, I was in luck.
Andy Thomson of webtatic.com has created Centos 5.3.6 RPMs and fully documented the install process. Thanks Andy!
I followed his directions and quickly had php 5.3 installed.
Somehow I missed the installation of the mcrypt extension however, and encountered problems with a couple of sites that use it.
Long story short, if you have followed Andy’s directions above, then all you need to do to install mcrypt is:
$ sudo yum --enablerepo=webtatic install php-mcrypt
Obtuse reader that I am, I initially installed mcrypt the manual and trickier way. In a nutshell, this involves grabbing the php source code from php.net and building the mcrypt extension. I document it here just in case it is useful for someone in a similar situation. The same basic process would work for any standard php extension.
Retrieve and uncompress the PHP source code
1
2
3
$ wget http://us3.php.net/get/php-5.3.6.tar.bz ... net/mirror
$ tar -xjf php-5.3.6.tar.bz2
$ cd php-5.3.6/ext/mcrypt/
Install some required development libraries
$ sudo yum install libmcrypt-devel php-devel
Setup extension for this system.
$ phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
1
2
3
$ ./configure && make
$ sudo make install
$ sudo vi /etc/php.d/mcrypt.ini
Enter the following text:
; Enable mcrypt extension module
extension=mcrypt.so
Test that it is loaded properly by php:
$ php -r "phpinfo();" | grep "mcrypt support"
mcrypt support => enabled
$ sudo /etc/init.d/httpd configtest
Syntax OK
$ sudo /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]