Install php5.2 sur centos
Un article de Casys (Canadian Sysadmins).
Installation php 5.2
Auteur: Thomas Boutry
- Télécharge php & décompression
cd /root/apps/ wget http://ca3.php.net/get/php-5.2.6.tar.bz2/from/this/mirror tar -jxvf php-5.2.6.tar.bz2
- Installation des packages dépendant
yum install httpd-devel libxml2-devel pcre-devel curl-devel mysql-devel libjpeg-devel gd-devel gmp-devel libmcrypt libmcrypt-devel unixODBC-devel libc-client-devel libtool-ltdl-devel
- Configuration et compilation
'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--with-pear' '--without-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/usr/share/file/magic.mime' '--with-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--with-mysql' '--with-gd' '--enable-dom' '--enable-dba' '--enable-pdo' '--enable-xmlreader' '--enable-xmlwriter' --with-mcrypt --enable-simplexml --with-imap-ssl --enable-mbstring make
- Suppression de l'ancienne version de php installé en rpm
rpm -e php-cli-5.1.6-20.el5_2.1 php-mbstring-5.1.6-20.el5_2.1 php-common-5.1.6-20.el5_2.1 php-5.1.6-20.el5_2.1 php-mysql-5.1.6-20.el5_2.1 php-imap-5.1.6-20.el5_2.1 php-pdo-5.1.6-20.el5_2.1
- Installation de la nouvelle & mise en place de la configuration de base
make install cp php.ini-recommended /etc/php.ini
- Commit le fichier de configuration original
ci -u /etc/php.ini
- Configuration de apache
vi /etc/httpd/conf.d/php.conf
Fichier:
# # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. # # # Cause the PHP interpreter to handle files with a .php extension. # AddHandler php5-script .php AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php # # Uncomment the following line to allow PHP to pretty-print .phps # files as PHP source code: # #AddType application/x-httpd-php-source .phps
- Redemarrage de apache
/etc/init.d/httpd restart
Installation de la librairie fileinfo
- Récupération et installation
wget http://pecl.php.net/get/Fileinfo-1.0.4.tgz tar -zxvf Fileinfo-1.0.4.tgz cd Fileinfo-1.0.4 pecl install fileinfo
- Configuration dans php.ini
co -l /etc/php.ini vi /etc/php.ini
Ajout de la ligne`:
extensions=/usr/lib/20060613/fileinfo.so
