PHP

From Wikislax
Jump to: navigation, search

What is PHP ?

PHP is a widely-used general-purpose scripting language that is specially suited for Web development and can be embedded into HTML.

Compiling c-client

The php imap option requires presence of library c-lient, which is part of Imap-uw, by the University of Washington. Download the software, untar and install :

# gunzip c-client.tar.Z
# tar -C /usr/local -xvf c-client.tar
# cd /usr/local
# chown -R root:root imap-2007f
# chmod -R o-w imap-2007f
# cd imap2007f
# make slx EXTRACFLAGS="-I/usr/include/openssl -g -O2 -fPIC" SSLCERTS=/etc/ssl/certs SSLKEYS=/etc/ssl/private

Compiling PHP

As PHP is part of the Slackware distribution, it's possible to skip the compilation step. If this is your choice, please note that /etc will be used for configuration files /usr/local/etc, and proceed to Configuring PHP.

Use ./configure --help | less to review the configuration options. --with-apxs2 is to work with apache 2. --with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysql/mysql.sock specify mysql use. --enable-mbstring and --with-mcrypt are recommended by phpMyAdmin. Some other options are required by Horde : --with-gettext to provide local translations of text, --with-iconv --enable-mbstring --enable-mbregex to handle multibyte character sets, --with-gd to perform image manipulations. --with-zlib is for page compression and handling of zip and gz data. Other options reflect the network configuration and solftware installed earlier on this site.

We also create a few hard links as by default php searches for libraries in lib and cannot find the libraries in lib64.

# tar -C /usr/local -xvf php-x.y.z.tar.gz
# cd /usr/local/php-x.y.z
# ln -s /usr/lib64/libjpeg.so /usr/lib
# ln -s /usr/lib64/libpng.so /usr/lib
# ln -s /usr/local/lib64/libldap.so /usr/local/lib
# ln -s /usr/local/lib64/libldap_r.so /usr/local/lib
# ln -s /usr/local/lib64/liblber.so /usr/local/lib
# mkdir /usr/local/mysql/lib
# ln -s /usr/local/mysql/lib64/libmysqlclient.so /usr/local/mysql/lib
# ln -s /usr/local/mysql/lib64/libmysqlclient.so.18 /usr/local/mysql/lib
# ln -s /usr/local/mysql/lib64/libmysqlclient_r.so /usr/local/mysql/lib
# less INSTALL
# ./configure --help | less
# CFLAGS="-g -O2 -fPIC" ./configure --libdir=/usr/local/lib64 --sysconfdir=/etc \
--with-apxs2=/usr/local/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql \
--with-mysql-sock=/var/run/mysql/mysql.sock --enable-mbstring --with-mcrypt \
--with-gettext --with-iconv --enable-mbregex --with-gd --with-zlib --disable-ipv6 \
--enable-ftp --with-openssl --with-ldap=/usr/local --with-ldap-sasl \
--with-imap=/usr/local/imap-2007f --with-imap-ssl --enable-opcache=no
# make
# make test
# removepkg /var/log/packages/php-x.y.z
# /etc/rc.d/rc.httpd stop
# make install
# make clean
# cp php.ini-production /etc/httpd/php.ini

Configuring PHP

The PHP configuration is defined in file php.ini and seems to be possibly installed in various locations, for example /etc/httpd or /usr/local/lib64/php.ini. Edit /etc/httpd/httpd.conf and add line LoadModule php5_module modules/libphp5.so to load the php module. The make install might have added this for you but be sure to check. Also tell apache to parse certain extensions as PHP adding line AddType application/x-httpd-php .php, and to show highlighted PHP source adding line AddType application/x-httpd-php-source .phps. Last restart apache using /etc/rc.d/rc.httpd start.

Note : when requiring to recompile or play around with configuration options, be sure to clear your browser's cache between trials.


Apache Main Page PhpMyAdmin