If you're trying to "roll your own" or install PHP and a Perl/CGI module on a *nix machine, here's the intructions:
Requirements
- Shell Access (if you don't have shell access ask your host)
- A copy of php 4.3.2 tar.gz (or any PHP version) which can be obtained here:
http://museum.php.net/php4/php-4.3.2.tar.gz
- Some knowlegde of shell & shell commands
Instructions
1. Download php-4.3.2.tar.gz from the above source
2. Upload php-4.3.2.tar.gz to your user root directory (right outside of your public_html directory)
3. Login using shell, and enter the following comands:
Then:
4. You will now need to cd into that directory, using the following command (replace [USERNAME] with your own username or your customer's username)
Code:
cd /home/[USERNAME]/php-4.3.2
5. You may now begin the installation, using the following command (replace [USERNAME] with your own username or your customer's username):
Note
This is all one line:
Code:
'./configure' '--with-mysql' '--enable-force-cgi-redirect' '--with-config-file-path=/home/[USERNAME]/local/etc/' '--enable-trans-sid' '--enable-ftp' '--with-xml' '--with-zlib' '--prefix=/home/[USERNAME]/local' '--without-pear' '--with-gd' '--with-jpeg-dir=/usr/lib'
6. Once this completes, type the following command:
Then:
Code:
make install prefix=$HOME
7. Now you will need to move the resulting binary file to a cgi-bin under your public_html folder. Use the following command to do that (replace [USERNAME] with your own username or your customer's username):
Code:
cp /home/[USERNAME]/bin/php /home/[USERNAME]/public_html/cgi-bin
8. Navigate to your public_html/cgi-bin direcory using an ftp client, and change the name of the php binary from php to php.cgi
9. Now cp the file php.ini-recommended to the cgi-bin and change the name to php.ini using the following command (replace [USERNAME] with your own username or your customer's username):
Code:
cp /home/[USERNAME]/php-4.3.2/php.ini-recommended /home/[USERNAME]/public_html/cgi-bin/
10. Now you will need to create an .htaccess file in your public_html directory to tell php where your new php install is. So create an .htaccess file, and put the following in it:
Code:
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi
Note
If there is already an htaccess file located in your public_html folder, it is important that you download the htaccess file, and add the above code to the file, then re-upload. If you don't, you will overwrite your existing htaccess file, and may cause some of the changes you made (including redirects, etc)
11. Set the permissions on the .htaccess file as such: chmod 0644
12. Test the installation by creating a php file, called: phpinfotest.php, and place the following code in it:
Upload it to any public directory on your site, and use a browser to view it.
It should contain the php installation information for your newly installed php.
Make sure to pay particular attention to the "Server API" section of the above test page. The value should be "CGI" If it's not, then your installation did not take.
Also pay attention to the "Configuration File (php.ini) Path" it should now be "/home/[USERNAME]/public_html/cgi-bin/php.ini"
WARNING
If you do not feel comfortable doing the above, then please do not attempt it. Any mistakes may cause configuration problems with your account, and may take some time to pinpoint and fix. So if you would like to install php in your local account, or one of your customer's accounts, but do not feel comfortable with the above, ask your host if they will do it for you.