While I know that you're probably thinking that your host limited the php usage on their server just to punish you, and now it's time to leave to find a new host, who doesn't impose these limits, don't go anywhere just yet
At the very least, if you can get your host to turn on SSH access for you, you can install your own PHP just for your own account!
Let's get started
The first thing, is to obtain the same version of PHP your host is currently using. For example purposes, we'll assume your host is running php4.3.2
So we go to http://www.php.net/releases and scroll down to the "4.3.2" section.
You'll want to download the "Source (tar.gz)" file.
Once you have this downloaded to your computer, we're ready to get into the meat of things.
Step By Step
Step 1
:
Upload php-4.3.2.tar.gz to your user root directory (right outside of your public_html directory)
Step 2:
Login using shell, and enter the following comands:
gunzip php-4.3.2.tar.gz
Step 3:
Enter the following command and hit enter
tar -xf php-4.3.2.tar
This will create a new directory called "php-4.3.2"
Step 4:
You will now need to cd into that directory, using the following command and hitting enter (replace [USERNAME] with your own username)
cd /home/[USERNAME]/php-4.3.2
Step 5:
You may now begin the installation, typing the following command and hitting enter (replace [USERNAME] with your own username):
Note:
This is all one line:'./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'
Step 6:
Once this completes, type the following command and hit enter:
make
Step 7:
Type the following command and hit enter:
make install prefix=$HOME
Step 8:
Now you will need to move the resulting binary file to a cgi-bin under your public_html folder. Type the following command and hit enter to do that (replace [USERNAME] with your own username):
cp /home/[USERNAME]/bin/php /home/[USERNAME]/public_html/cgi-bin
Step 9:
Now you can 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
Step 10:
Now cp the file php.ini-recommended to the cgi-bin using the following command (replace [USERNAME] with your own username):
cp /home/[USERNAME]/php-4.3.2/php.ini-recommended /home/[USERNAME]/public_html/cgi-bin/
Step 11:
You can ftp into your cgi-bin and change the name of "php.ini-recommended" to php.ini
Step 12:
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:
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)
Step 13:
Set the permissions on the .htaccess file as such: chmod 0644
Step 14:
Test the installation by creating a php file, called: phpinfotest.php, and place the following code in it:
<?php
phpinfo();
?>
Step 15:
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