Difference between revisions of "Apache w/ PHP Support (PowerPC)"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(Opening Comments)
Line 15: Line 15:
 
Apache, along with PHP, is very straight forward to install on a stock LinkStation 1 or Linkstation HG with the OpenLink firmware installed.  If you have experience with building these packages, or compiling in general, it is a snap.  If you have little or no experience in such matter, just follow the guide -- everything is reversible.
 
Apache, along with PHP, is very straight forward to install on a stock LinkStation 1 or Linkstation HG with the OpenLink firmware installed.  If you have experience with building these packages, or compiling in general, it is a snap.  If you have little or no experience in such matter, just follow the guide -- everything is reversible.
  
If you have not already done so, visit the [[Projects/OpenLink | Openlink]] section and follow the instructions for installing the telnet enabled firmware.  You will also need to download and install the [http://downloads.linkstationwiki.net/development_tools/ppc-tools-2.tgz PPC Tools] before continuing.
+
If you have not already done so, visit the [[Projects/OpenLink | Openlink]] section and follow the instructions for installing the telnet enabled firmware.  You will also need to download and install the [http://downloads.nas-central.org/ALL_PPC/ppc-tools-2_1.tgz PPC Tools] before continuing.
  
 
== A Remark on "--prefix" ==
 
== A Remark on "--prefix" ==

Revision as of 01:18, 11 September 2007

Created by Brummierob...
Based on the original LAMP by Nick which was edited by ...
BurnHard, frontalot, Cathedrow & Ralf from linkstationwiki.org

Installing Apache w/ PHP Support.


Contents

Opening Comments

The reason for this Article is for those of you who want to install Media-Software (such as Oxyl~box), where no MySQL is required. This is a good way of saving precious resources on the Linkstation!

LAP (or L.A.P.) is basically LAMP (or L.A.M.P.) without MySQL. LAP refers to a set of free software programs commonly used together to run dynamic Web sites or servers:

Apache, along with PHP, is very straight forward to install on a stock LinkStation 1 or Linkstation HG with the OpenLink firmware installed. If you have experience with building these packages, or compiling in general, it is a snap. If you have little or no experience in such matter, just follow the guide -- everything is reversible.

If you have not already done so, visit the Openlink section and follow the instructions for installing the telnet enabled firmware. You will also need to download and install the PPC Tools before continuing.

A Remark on "--prefix"

The prefix argument, which you will see in every section below, allows you to install Unix packages to alternate locations. This is very important and should be remembered for the LinkStation as the two packages (Apache1.3 + PHP) take over 40 megs of space once they are installed. You will not be able to install these packages to your root partition and doing so would be very bad.

I chose (as is often suggested) to create an "opt" directory under "/mnt/" to install each of the packages into, using a separate directory for each. This was done to keep the packages separated and easy to manage in the future. You may, of course, alter your install locations in any way but, if you are new to this, I suggest following my example.

It's also a good idea to create a directory to download stuff when using wget, lets use /mnt/misc


Update Grep

The first step is to update grep. This step isn't too complicated.

  • Firstly, download the latest version of grep (in my example the grep-2.5.1a version, the latest version at time of edit) from the GNU Project.
  • Then extract the tarball and move to the new grep directory. Use the following commands:
cd /mnt/misc 
wget http://ftp.gnu.org/gnu/grep/grep-2.5.1a.tar.gz 
tar -zxvf grep-2.5.1a.tar.gz 
cd grep-2.5.1a
  • Next, configure the makefile with this command:
./configure 
make 
make install

DO NOT UNINSTALL OLD VERSION OF GREP!!!: Certain programs still depend on this version and you will possibly loose terminal access to the Linkstation if you do.


Installing Apache 1.3.xx

Apache itself is the next to install. If you are not planning on installing PHP, you may ignore the "--enable-module=so" attribute below.

I decided to install Apache 1.3 because I thought it would use less system-resources than Apache 2. Installing Apache 2 would be very similar and the following instructions could easily be adapted by reading the INSTALL document in the Apache 2 tarball.

cd /mnt/misc

Download the latest version of Apache 1.3 from http://www.apache.org (1.3.37, at the time of this edit).

wget http://mirrorspace.org/apache/httpd/apache_1.3.37.tar.gz
tar -zxvf apache_1.3.37.tar.gz
cd apache_1.3.37


./configure --prefix=/mnt/opt/apache --enable-module=so
make
make install

You should get this message -

+--------------------------------------------------------+
| You now have successfully built and installed the      |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the         |
| (initially created or preserved) configuration files   |
|                                                        |
|   /mnt/opt/apache/conf/httpd.conf
|                                                        |
| and then you should be able to immediately fire up     |
| Apache the first time by running:                      |
|                                                        |
|   /mnt/opt/apache/bin/apachectl start
|                                                        |
| Thanks for using Apache.       The Apache Group        |
|                             http://www.apache.org/     |
+--------------------------------------------------------+

You will, at the very least, need to change your port to 81 (or some other port).

vi /mnt/opt/apache/conf/httpd.conf

Search for '80' -- change it to '81' (or some other port).

I also suggest changing the root directory to the files to "/mnt/opt/apache/htdocs/oxylbox". Search for 'DocumentRoot' and change the first reference (roughly line 288) to the above path. Search again and you will find another reference to change (around line 313).

Finally, start the server.

/mnt/opt/apache/bin/apachectl start

Copy that start up script to /etc/init.d and include in startup shutdown

cp /mnt/opt/apache/bin/apachectl /etc/init.d
ln -s /etc/init.d/apachectl /etc/rc.d/rc2.d/S99apachectl
ln -s /etc/init.d/apachectl /etc/rc.d/rc6.d/K92apachectl
ln -s /etc/init.d/apachectl /etc/rc.d/rc0.d/K92apachectl
  • TODO: Flush out the config file editing instructions.

Installing PHP

Last we will set up PHP. I decided to install the latest version of PHP4 because, again, this is what my web host uses. You may decide to install PHP5, which would requires only 1 slightly different step below.

IMPORTANT

Pay special attention to the 'configure' command below. If you installed the above packages to an alternate location you will need to update the paths in the proper attribute.


cd /mnt/misc

Download the latest version of PHP4 from http://www.php.net (4.4.4, at the time of this edit).

wget http://de.php.net/get/php-4.4.4.tar.bz2/from/uk2.php.net/mirror

or you can download the older 4.4.3 version here

wget http://de.php.net/get/php-4.4.3.tar.bz2/from/uk2.php.net/mirror


It may download as a file called 'mirror' if so do

mv mirror php-4.4.4.tar.bz2

Next

bunzip2 php-4.4.4.tar.bz2

tar -xvf php-4.4.4.tar 
cd php-4.4.4

This is all one command and should be input on one line

./configure --prefix=/mnt/opt/php4 --with-apxs=/mnt/opt/apache/bin/apxs
--with-config-file-path=/mnt/opt/php4/lib


Should get this

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
|                          *** NOTE ***                              |
|            The default for register_globals is now OFF!            |
|                                                                    |
| If your application relies on register_globals being ON, you       |
| should explicitly set it to on in your php.ini file.               |
| Note that you are strongly encouraged to read                      |
| http://www.php.net/manual/en/security.globals.php                  |
| about the implications of having register_globals set to on, and   |
| avoid using it if possible.                                        |
+--------------------------------------------------------------------+
make

You will get a message

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

Then to finish

make install

Copy over the default config file.

IMPORTANT

If you altered the "--with-config-file-path" attribute, above, you will need to change the below command to copy to the appropriate path.

cp php.ini-dist /mnt/opt/php4/lib

Open up apache's conf file and verify that the following line is included:

vi /mnt/opt/apache/conf/httpd.conf
LoadModule php4_module libexec/libphp4.so (for PHP4)
LoadModule php4_module libexec/libphp5.so (for PHP5)

If it is not, add it. Also add the following two lines just below the LoadModule command:

AddType application/x-httpd-php .php .phtml                  
AddType application/x-httpd-php-source .phps                       

Restart Apache and PHP should now be working.

/etc/init.d/apachectl restart
  • TODO: More information on configuration of PHP
  • TODO: Information on adding additional modules to PHP