(Answer) (Category) Linux on PowerPC FAQ-O-Matic : (Category) Applications :
How to install Apache/MySQL/PHP(4) on LinuxPPC
HOW-TO Install Apache/MySQL/PHP


Here are some instructions for installing Apache (from source) with support for
Dynamic Shared Objects (DSO), installing MySQL (from source), and installing
PHP (again from source) as an Apache DSO with support for MySQL.  Simple (and
incomplete) configuration and testing for the set-up are also described.  

Notes:
* PM7300/200 running a bare-bones installation of LinuxPPC 2000. 
* If you have earlier versions of these programs already installed you MAY want
to remove them (use "rpm -e packagename" for removing RPM files, and try "make
uninstall" from the build directory if you installed from source).
* I believe you will only need to be super-user for the "make install(s)",
though I did all steps below as "root" for convenience.
* For expanding and un-taring source archives I've used the /usr/src directory,
you may prefer to use /usr/local/src or some other location - whatever you
prefer, it is not critical (though it might be religiously relevant).
* I installed this stuff to learn about it - so I really can't answer specific
Apache, MySQL, or PHP questions.  Also- this installation might not provide all
the functionality you desire, it is just shown as an example that worked for
me.  As always, your mileage may vary.


1. Install Apache from source
        
        cd /usr/src
        wget http://httpd.apache.org/dist/httpd/apache_1.3.19.tar.gz
        tar -xzvf apache_1.3.19.tar.gz              
        cd apache_1.3.19
        ./configure --prefix=/usr/local/apache --enable-module=so
        make
        make install
        
If there are errors while running the configure script then you are likely in
need of additional packages/libraries -- the missing components are usually
printed in the error message.  If you have problems compiling the source, i.e.,
you get make errors, see
http://lists.linuxppc.org/listarcs/linuxppc-user/200105/msg00045.html for
some newbie level help -and/or- read the Apache documentation and check the
Apache www site for clues.  


2. Configure Apache (if needed)

        cd /usr/local/apache/conf
        
and edit the "httpd.conf" file to put real values in for "ServerAdmin" and
"ServerName".  For example:

        ServerAdmin admin@monkey.nuts.org
        ServerName monkey.nuts.org (or localhost if you lack a real host name)
        

3. Start, Test, and Stop Apache

        /usr/local/apache/bin/apachectl start
        lynx localhost (you should get a generic Apache message)
        
You can find the Apache-served .html docs at /usr/local/apache/htdocs, and can
stop the server using:

        /usr/local/apache/bin/apachectl stop
        
        
4. Install MySQL from source

        cd /usr/src
        wget http://www.mysql.com/Downloads/MySQL-3.23/mysql-3.23.37.tar.gz
        tar -xzvf mysql-3.23.37.tar.gz
        cd mysql-3.23.37
        ./configure --prefix=/usr/local/mysql
        
In my case the configure script kept reporting errors due to missing
packages/libraries.  I started with a bare-bones installation, so this is to be
expected.  I had to add/update the following RPM's to get through the configure
script without errors: libstdc++, gcc-c++, & ncurses-devel.  The configure
script errors are often informative - they will usually be very clear about
what is missing, and will almost always provide enough info to, at the very
least, make a good guess.
        
        make
        
This might take a while...

        make install


5. Configure MySQL

If you are running MySQL for the first time you need to create the default
permissions:
        
        /usr/src/mysql-3.23.37/scripts/mysql_install_db

Start the MySQL daemon:

        /usr/local/mysql/bin/safe_mysqld &
        
Test it by running:

        usr/local/mysql/bin/mysqlshow
        
                which should produce something like:
                +-----------+
                | Databases |
                +-----------+
                | mysql     |
                | test      |
                +-----------+
        

6. Install PHP from source
        
(first, install the "bison" and "flex" packages if needed)
        
        cd /usr/src
        wget http://www.php.net:80/distributions/php-4.0.5.tar.gz
        tar -xzvf php-4.0.5.tar.gz
        cd php-4.0.5
        ./configure --with-mysql=/usr/local/mysql \
        > --with-apxs=/usr/local/apache/bin/apxs
        make
        make install
        
        
7. Configure PHP as a DSO for Apache

With a text editor open "/usr/local/apache/conf/httpd.conf" and edit the
following lines to look like:
        
        # And for PHP 4.x, use:
        #
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
    
(i.e., remove the two comment marks on the "AddType" lines)
        
        
8. Restart Apache (with PHP loaded as a DSO)

If Apache is running, stop it with:

        /usr/local/apache/bin/apachectl stop
        
And then restart it using:

        /usr/local/apache/bin/apachectl start
        
If Apache won't start it likely can't find a MySQL client lib.  I got this
error:
...
Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server:
libmysqlclient.so.10: cannot open shared object file: No such file or directory
...

So Apache can't find "libmysqlclient.so.10".

        find / -name 'libmysqlclient.so.10'
        
        /usr/local/mysql/lib/mysql/libmysqlclient.so.10
        /usr/src/mysql-3.23.37/libmysql/.libs/libmysqlclient.so.10
        
The fix can be found in the Meloni reference: 

        * add the appropriate path to the "/etc/ld.so.conf" file

Well - I didn't have this file at all!  Just use a text editor to make the file
"/etc/ld.so.conf" with the line:

                /usr/local/mysql/lib/mysql/     
        
        * /sbin/ldconfig -v
        * /usr/local/apache/bin/apachectl start

Apache started successfully once I added the appropriate lib directory.


9. Test the installation

        cd /usr/local/apache/htdocs
        
Use a text editor to make the file "phpinfo.php" with the following line:

        <? phpinfo() ?>
        
Then use a web browser to test it; as a lovely text-browser example:

        lynx localhost/phpinfo.php
        
This should produce a page showing a wealth of information about your set-up
(that should include MySQL and Apache-specific info).  Congrats!
        

References

Dice, Richard "Choosing the Right Database System"
http://hotwired.lycos.com/webmonkey/backend/databases/tutorials/tutorial1.html
        
Meloni, Julie "PHP4 Installation Overview"
http://hotwired.lycos.com/webmonkey/00/44/index4a.html?tw=programming

Merrall, Graeme "PHP/MySQL Tutorial"
http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html


Thanks: Chris Boot
lemonds@hawaii.edu
[Append to This Answer]
Previous: (Answer) How to install proftpd using RPM files (general RPM instructions)
Next: (Answer) wget keeps throwing a SegFault when I try to use it's --recurisve feature. What shall I do?
This document is: http://www.jonh.net/cgi-bin/lppcfom/fom?file=1048
[Search] [Appearance]
This is a Faq-O-Matic 2.717d.
Hosted by anduin.org and SourceForge Logo