I signed up for a shared hosting package at Hostgator. So far so good, but I run into trouble when executing Symfony 2.1 console commands via ssh.
By default, Hostgator provides php v5.2. After some googling, I found that adding the following lines to the document root .htaccess file will turn on php v5.3, as required by Symfony:
Action application/x-hg-php53 /cgi-sys/php53
AddType application/x-httpd-php53 .php
suPHP_ConfigPath /opt/php53/lib
Great! The Symfony pages are rendered without errors. Only problem is when I use the CLI console for commands such as:
app/console cache:clear
or
app/console doctrine:schema:update --force
Then I get the typical PHP version compatibility error:
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home/mysite/public_html/Symfony/app/console on line 13
Caused by the php 5.3 “use” keyword parsed by a php 5.2 engine.
After 1 hour spent trying to convince a Hostgator representative that there was no syntax error in the Symfony console script, but their CLI was running php 5.2, I am turning to you guys for help on how to get the CLI to run php 5.3 at Hostgator.
I made it!
for running commands using php5.3 in hostgator, you have to execute:
/opt/php53/bin/phpexample, the symfony console: