- Bestellen
- Providerwechsel
- Rechnung & Vertrag
- Service & Infos
- Domains
- Homepage-Baukasten
- ManagedHosting & ManagedServer
- Webhosting & Webhosting Plus
- CloudServer
- SSL-Zertifikate
- Microsoft 365
- Reseller
- Sucuri Website Security
- Managed Wordpress
- Aktuelles
PHP kompilieren (CentOS)
Alle ausklappen
Alle einklappen
Einleitung
Hier erfahren Sie, wie Sie PHP in der Version 5.2.13 unter CentOS 5 kompilieren.
Development-Tools installieren
1. Installieren Sie zunächst die Development-Tools unter CentOS:
# yum groupinstall "Development Tools"
2. Installieren Sie nun die Devel-Pakete, die für die Konfiguration benötigt werden:
# yum install httpd httpd-devel libxml2-devel libxslt-devel\
openssl-devel pcre-devel bzip2-devel curl-devel\
libjpeg-devel libpng-devel freetype-devel gmp-devel\
libc-client-devel libmcrypt-devel mysql-devel unixODBC-devel\
postgresql-devel sqlite-devel aspell-devel net-snmp-devel ncurses-devel
PHP herunterladen und konfigurieren
1. Da für PHP derzeit nicht alle installierten Bibliotheken gefunden werden, ist es
notwendig, die folgenden Symlinks anzulegen:
# ln -s /usr/include /opt/include
# ln -s /usr/lib64 /opt/lib
2. Anschließend werden die Pakete für "mcrypt" benötigt, da sich diese derzeit nicht im offiziellen Repository befinden:
# wget ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
# wget ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm
3. Installieren Sie die Pakete mit den folgenden Befehlen:
# rpm -ivh libmcrypt-2.5.8-9.el6.x86_64.rpm
# rpm -ivh libmcrypt-devel-2.5.8-9.el6.x86_64.rpm
4. Laden Sie PHP in Ihrer gewünschten Version unter http://us3.php.net/releases/ herunter:
5. Entpacken Sie das Paket mit dem folgenden Befehl:
# tar xvf php-X.X.X.tar.bz2
6. Wechseln Sie in das entpackte Verzeichnis:
# cd php-X.X.X
7. Beginnen Sie, PHP zu konfigurieren:
# ./configure --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 --with-libdir=lib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-debug --with-pic --disable-rpath --with-pear --with-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-pspell --with-libexpat-dir=/opt --with-pcre-regex --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-wddx --with-kerberos --enable-ucd-snmp-hack --with-unixODBC=shared,/usr --enable-shmop --enable-calendar --with-mime-magic=/usr/share/file/magic.mime --without-sqlite --with-libxml-dir=/usr --enable-xml --enable-force-cgi-redirect --enable-pcntl --with-imap=shared,/opt --with-imap-ssl --enable-mbstring=shared --enable-mbregex --with-ncurses=shared --with-gd=shared --enable-bcmath=shared --enable-dba=shared --with-db4=/opt --with-xmlrpc=shared --with-ldap=shared,/opt --with-ldap-sasl --with-mysql=shared --with-mysqli=shared,/usr/bin/mysql_config --enable-dom=shared --with-pgsql=shared --with-snmp=shared,/usr --enable-soap=shared --with-xsl=shared,/usr --enable-xmlreader=shared --enable-xmlwriter=shared --enable-fastcgi --enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr --with-pdo-mysql=shared,/usr --with-pdo-pgsql=shared,/usr --with-pdo-sqlite=shared,/usr --enable-dbase=shared --with-mcrypt --with-apxs2=/usr/sbin/apxs
PHP kompilieren und installieren
1. Wenn alles ohne Fehlermeldung durchgelaufen ist, kompilieren und installieren Sie PHP:
# make && make install
2. Wenn auch dieser Schritt ohne Fehlermeldungen beendet ist, legen Sie bitte die Datei php.conf in /etc/httpd/conf.d/ mit dem folgenden Inhalt an:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
LoadModule php5_module modules/libphp5.so
#
# 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
3. Damit das PHP-Modul nicht doppelt geladen wird, entfernen Sie in der Datei /etc/httpd/conf/httpd.conf folgende Zeile:
LoadModule php5_module modules/libphp5.so
4. Starten Sie mit folgendem Befehl den Apache 2 neu:
# service httpd restart
Nach dem Neustart ist mod_php dann funktionsfähig.