Parse error on Facebook Application with GoDaddy hosting php4 & php5
Thursday July 12th 2007, 9:44 am
Filed under: Underground

Fixing code

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.


8 Comments so far
Leave a comment

Good example of a great facebook app! http://apps.facebook.com/thenewsroom

Comment by Ian from www.thenewsroom.com 08.04.07 @ 11:44 am

hi nice post, i enjoyed it

Comment by Kailee 08.19.07 @ 12:14 am

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.

Comment by snipe 08.21.07 @ 10:24 pm

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. :(

Comment by snipe 08.21.07 @ 10:25 pm

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.

Comment by butna 09.01.07 @ 5:48 pm

Thanks a lot. I fixed my problem with your advice ;)

Comment by sounder 09.21.07 @ 4:43 am

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

Comment by JTPratt's Blogging Mistakes 01.22.08 @ 12:16 pm

Thank you very much… for three days i was confused a lot… .htaccess changes help me much more..
Thanking you

Comment by Raja 07.18.08 @ 9:06 am



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>