PHP: Difference between revisions
No edit summary |
|||
| Line 1: | Line 1: | ||
PHP is a | PHP is a server-side scripting library. | ||
== Installation == | == Installation == | ||
| Line 23: | Line 22: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Troubleshooting === | |||
==== PDOException : could not find driver ==== | |||
You need to have the pdo driver installed. In my case, I was trying to use the pdo-mysql connector which wasn't compiled with PHP. To fix this, install the PDO driver or compile it manually with: | |||
--with-pdo-<driver> | |||
In my case, I needed mysql: | |||
--with-pdo-mysql | |||
[[Category:Linux]] | [[Category:Linux]] | ||
[[Category:Code]] | [[Category:Code]] | ||
Revision as of 05:57, 26 June 2013
PHP is a server-side scripting library.
Installation
The instructions here will enable you to compile (the latest version of) PHP for a prepackaged apache install. The trick is to have httpd-devel installed which will have the apxs2 binaries necessary to build PHP for apache. This is useful as PHP is not updated as frequently as desired for CentOS.
On CentOS (or any other RHEL based distro), run:
# Install rpmforge repo
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm
# Install all prerequisites.
yum -y install make autoconf g++ gcc-c++ libtermcap-devel libgcc-c++ libtool gcc libpng-devel libjpeg-devel libxml1-devel libxml2-devel curl curl-devel libmcrypt libmcrypt-devel libtool-ltdl-devel libxml2.x86_64 libxml2-devel.x86_64 curl-devel.x86_64 openssl-devel httpd-devel
# Compile PHP
# Go to the PHP source directory, then run:
./configure --prefix=/opt/php5 --with-apxs2 --with-config-file-path=/etc/ --with-gd --enable-shmop --enable-ftp --enable-sockets --enable-exif --enable-zip --enable-sysvsem --with-zlib --enable-sysvshm --with-jpeg-dir --with-png-dir --enable-mbstring --enable-embedded-mysqli=shared --with-curl --with-mcrypt --with-mysql --with-mysqli
Troubleshooting
PDOException : could not find driver
You need to have the pdo driver installed. In my case, I was trying to use the pdo-mysql connector which wasn't compiled with PHP. To fix this, install the PDO driver or compile it manually with:
--with-pdo-<driver>
In my case, I needed mysql:
--with-pdo-mysql