|
You can fetch the PHP distribution from
php.net (or
ftp.csoft.net/distfiles)
and unpack it in some temporary location:
$ tar -xzf php-x.x.tar.gz
$ cd php-x.x
Now choose the compilation settings. Again, please save the
./configure arguments to ~/src/php-config.sh.
To ensure best performance, make sure to explicitely disable
all the options which you do not require (these will otherwise be enabled
by default if they exist on the system). The --prefix,
--with-apxs2 and --disable-cgi options are required.
A typical configuration might look like:
./configure \
--prefix=$HOME/apache \
--with-apxs2=$HOME/apache/bin/apxs \
--with-config-file-path=$HOME/apache/conf \
--disable-cgi \
--disable-cli \
--disable-ipv6 \
--with-zlib=/usr \
--with-mysql=/usr/local \
--with-mysqli=/usr/local/bin/mysql_config \
--with-pgsql=/usr/local \
--without-mcrypt \
--without-mhash \
--without-imap \
--without-imap-ssl \
--without-gd \
--without-ttf \
--without-gettext \
--without-iconv \
--enable-libxml
If you are migrating from the shared Apache and want to make sure
to use the same settings, you can check the phpinfo() for the
PHP configuration you were previously using:
$ echo '<?phpinfo()?>' php4-fat > php4-fat.html
$ lynx php4-fat.html
You will probably want to enable
GD and JPEG/PNG if
some of your scripts are using imaging features.
The --with-gd and --with-ttf options require special
consideration. If your account is on an OpenBSD server, substitute
/usr/local for /usr/X11R6.
--with-gd=/usr/local \
--with-ttf=/usr/local \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local
If your scripts use internationalization, enable
iconv and
gettext:
--with-iconv=/usr/local \
--with-gettext=/usr/local
If your scripts need the MBSTRING extension, use --enable-mbstring.
Do not enable this option unless you really need it.
When you are satisfied with the settings, install PHP and copy the
example php.ini to the directory specified in
--with-config-file-path. Open up php.ini in an editor
and tweak the settings to your liking.
$ sh ~/src/php-config.sh
$ make all install
$ cp php.ini-dist ~/apache/conf/php.ini
$ cp /etc/php5/php.ini ~/apache/conf/php.ini
If you were previously using, say, the php5-fat configuration, you
can copy the standard server php.ini:
$ cp /etc/php5-fat/php.ini ~/apache/conf
Finally, make sure the necessary directives exist in your httpd.conf:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
AddType text/html .php
DirectoryIndex index.html index.php
|