PHP 5.3 on CentOS 5.5
I have compiled the latest PHP version, 5.3.6, and put it in the Webtatic repository for easy installation. I have compiled it for CentOS 5 i386 and x86_64, and provided the source RPMS in the repo, if anyone wants to compile it for another OS or architecture.
Update 2009-07-03 – I updated the version to PHP 5.3, which was released a few days before. This includes many new features such as closures, namespaces, and packaged scripts in phar files, which I’ll blog about soon. Check out PHP changelog for more details.
Update 2009-09-01 – Added a note about deprecated errors, and how to silence them. Also I have included a tip that might help those of you struggling to install.
Update 2010-03-03 – I’ve added both apc 3.1.3p1 beta (php-pecl-apc in yum) and eAccelerator 0.9.6 (php-eaccelerator in yum) RPMs to the repository, they are compiled for (and work on) php 5.3.x
Update 2009-09-01 – Added a note about deprecated errors, and how to silence them. Also I have included a tip that might help those of you struggling to install.
Update 2010-03-03 – I’ve added both apc 3.1.3p1 beta (php-pecl-apc in yum) and eAccelerator 0.9.6 (php-eaccelerator in yum) RPMs to the repository, they are compiled for (and work on) php 5.3.x
I have also included the same php extensions I mentioned in my other article, php-mcrypt, php-mhash (in PHP 5.2), php-mssql and php-tidy
To install, first you must tell rpm to accept rpm’s signed by me, then add the yum repository information to yum:
Now you can install php by doing:
Or update an existing installation of php, which will also update all of the other php modules installed:
Packages
Package | Provides |
---|---|
php | mod_php |
php-bcmath | |
php-cli | php-cgi, php-pcntl, php-readline |
php-common | php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib |
php-dba | |
php-devel | |
php-eaccelerator | |
php-embedded | php-embedded-devel |
php-fpm | |
php-gd | |
php-imap | |
php-intl | |
php-ldap | |
php-mbstring | |
php-mcrypt | |
php-pecl-apc | |
php-pecl-memcache | |
php-pecl-xdebug | |
php-mssql | php-pdo_dblib |
php-mysql | php-mysqli, php-pdo_mysql, php_database |
php-odbc | php-pdo_odbc, php_database |
php-pdo | |
php-pgsql | php-pdo_pgsql, php_database |
php-process | php-posix, php-sysvmsg, php-sysvsem, php-sysvshm |
php-pspell | |
php-recode | |
php-snmp | |
php-soap | |
php-suhosin | |
php-tidy | |
php-xml | php-dom, php-domxml, php-wddx, php-xsl |
php-xmlrpc | |
php-zts |
“Depsolving” problems
If you get depsolving problems when updating, you may have currently installed some extensions that have been removed, e.g. php-mhash, php-ncurses.
You will need to remove them before upgrading.
Timezone Errors
If you have not set the default timezone for dates, you will get PHP warnings and in some cases fatal errors (e.g. when using the DateTime object). PHP will by default use the system’s timezone if not a fatal error, however either in your application or the php.ini, you should set the setting date.timezone. It’s more ideally set in the application, which should be aware of it’s own timezone setting.
Deprecated Errors
Once you are running the new version, you may get “deprecated” errors in your error logs. This isn’t bad, it just means to tell you that some of the functions you are using are no longer prefered, and may be removed in a future major release. An example of this is the ereg functions. Preg functions are prefered over these, as they are much faster and more powerful, and in all cases do at least the same thing.
If upgrading the functions are not an option, and you would like to hide the deprecated errors from your error log, for example on a production server, just edit your /etc/php.ini file, find the line:
and replace to:
PHP 5.2.17
I am also maintaining a PHP 5.2.17 release, so should you prefer to install that (for reasons like incompatibilities or testing), you can force it to install that instead by doing:
Or you can add to the /etc/yum.repos.d/webtatic.repo the line: