|
You can fetch the PHP distribution from
php.net
and unpack it in some temporary location:
$ tar -xzf php-x.x.tar.gz
$ cd php-x.x
Now is time to define the compile-time settings. We recommend saving
the ./configure arguments to a text file such as
$HOME/php-config.sh
to faciliate further upgrades. 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-libxml \
--disable-ipv6 \
--with-zlib=/usr \
--with-mysql=/usr/local \
--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
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 $HOME/php-config.sh
$ make all install
$ cp php.ini-dist $HOME/apache/conf/php.ini
$ cp /etc/php5/php.ini $HOME/apache/conf/php.ini
If you were previously using, for example, the php5-fat
configuration, you can copy the standard server php.ini:
$ cp /etc/
Finally, make sure the necessary directives exist in your httpd.conf:
LoadModule php5_module modules/libphp5.so
AddHandler php-script php
AddType text/html php
|