Parse error on Facebook Application with GoDaddy hosting php4 & php5
Posted on July 12, 2007
Filed Under Underground |
Developing a Facebook application on a server hosted with GoDaddy, we kept on getting a parse error on line# such and such when the application was tested.
What was the problem?
The problem was that GoDaddy runs php version 4 and version 5 concurrently with the Linux hosting configuration 2.0 . Facebook applications only run on php version 5. When checking the version of php, the script <?php phpinfo(); ?> indicates that GoDaddy is running php version 4.3.
How to fix this?
Well, there are a lot of proposed fixes out there. Difficult to find and GoDaddy documentation and customer service is unclear and muddled. The simple fix, include a .htaccess file in the root directory with the following line below:
AddHandler x-httpd-php5 .php
Link for more info from GoDaddy
Thus, all your php now looks like php5 to GoDaddy and your Facebook applications work. Same thing for Joomla btw.
Comments
4 Responses to “Parse error on Facebook Application with GoDaddy hosting php4 & php5”
Leave a Reply
Should be noted that this fix will only work if your server is running php4 and php5. The htaccess simply tells Apache to use php5 instead of php5, fixing the “try” and “catch” tags that are part of php5. If your server isn’t running php5 at all, you’re still boned.
Sorry, that should have read:
Should be noted that this fix will only work if your server is running php4 and php5. The htaccess simply tells Apache to use php5 instead of php4, fixing the “try” and “catch” tags that are part of php5. If your server isn’t running php5 at all, you’re still boned.
Been a long day trying to get a decent fix for the php4 issue.
Thanks for this. I believe that I was definitely having the same issue, although I won’t be sure until the .htaccess cache is reset.
Which gets me to another stupid question, in the godaddy article referenced, they say that changing an existing .htaccess will take affect immediately. However if you delete and then create a new file, then you have to wait for the cache clear. This makes no sense to me, because the only way to change the file is by uploading a new file, and ftp is going to overwrite (aka delete) the old file everytime. There isn’t a way to edit this file in place on their filesystem is there? Unless maybe through one of their web utilities..? I haven’t checked that.
works as advertised! Also would like to point out that if you just want to parse and run PHP code in an .html or .htm file - you can just add a line like this:
AddHandler x-httpd-php .php .htm html