Installing apache and PHP in /opt

randhir phagura rsphagura at
Sun Aug 28 18:25:02 PDT 2005


This is for newbees like me. It may be useful for some.

Installing programms such as apache and PHP in a separate directory than 
'/usr' has certain advantages for upgrading later. Took the cue from 'qt' 
installation in the book.

I have installed apache-2.0.54 & PHP-5.0.4 in '/opt/apache' and '/opt/php' 
for similar reason. It needs slightly diffrent treatment, which I jot down 
below for anyone wishing to do the same:

1. Firstly, 'apache-2.0.54' install:

For PHP, apache is required. It has a given patch for FHS install. This 
patch enforces apache install in '/usr' and the rest accordingly. The first 
line of <Layout FHS> section of the patch is :
'+    Prefix:      /usr'. Edit this to your need such as substitute 
'/opt/apache' in place of '/usr'. This can probably be done with a suitable 
'sed' command. But I am not familiar with 'sed' yet. The remaining two 
sections <Layout apr> etc may be commented out.
Also, include the option '--enable-so'. PHP complains if not done.
Almost everyone installs 'expat' for some reason or the other. Do not, 
therefore, ignore the warning in the Book. Include the option  
'--with-expat=/usr' in configure, if you have expat. If you ignore this, 
there may be trouble opening various icons from your desktop. If that does 
happen, re-install 'expat'. Modify the other commands in the book suitably 
for your install such as changing '/usr' to '/opt/apache' whereever it 

2. PHP install:

PHP install is as in the Book except that change your 'prefix' as required. 
PHP has a problem finding 'apxs' from apache install. Give full path to this 
such as (in my case) '--with-apxs2=/opt/apache/sbin/apxs'. Read './configure 
--help' for an explanation.

Also, other applications may be looking for 'apxs' later. Install a link in 
'/opt/apache/bin/apxs' to /opt/apache/sbin/apxs'.

All the best and Regards,

Randhir Phagura

NRI Account! 
Special FREEDOM OFFER from Citibank! Grab it now!

More information about the blfs-support mailing list