Web Design and Development
HostGator is one of the few hosts that enable its shared hosting accounts to use PHP 5.3. And enabling it is easy. Customers just need to add two directives to an .htaccess file, and Voila, their files are running on PHP 5.3! However, if you are trying to use PHP 5.3 for your cron jobs and secure shell (SSH), it can be a bit tricky. You will find that the .htaccess directives only control what version of PHP is used when the files are accessed via HTTP, and have no impact on cron jobs or SSH.
To run a cron job or execute a PHP script using SSH, the default command which uses PHP 5.2, looks something like the example below.
For PHP 5.3, you just need to change the path to PHP. See the revised example below.
And that's all. In SSH, you can also verify the version of PHP with the following command. Currently, HostGator is running PHP 5.3.8.
For other web hosts that allow you to optionally choose a non-default version of PHP, the process will be similar. You will need to find the correct path and use it to execute your scripts. Creating a
file will yield some clues, but it might be easier to simply ask your hosting provider where the path is to the version of PHP that you want to use.Tags: cron jobs, HostGator, htaccess file, PHP, shared, SSH