I’m trying to implement the simple-linkedinphp library (it’s found at http://code.google.com/p/simple-linkedinphp/)
It runs fine on localhost, but when I upload it to the server I get a 500 Internal Server Error. Here’s what the error log says:
[12-Feb-2012 20:35:09] PHP Parse error: syntax error, unexpected T_STRING in /home1/bangaban/public_html/LIAPIwrappertest/linkedin_3.1.1.class.php on line 1
This doesn’t help because line 1 is just the opening <?php tag and then some comments.
The library requires PHP 5+ and the cURL extension on the server and phpinfo() shows that to be installed. I don’t think there are any syntax errors in the script because it works fine on localhost and it’s a library that’s been used by many people.
I googled and found some resources that talk about 500 errors being caused by write access; this question talks about that a bit, but it’s a different error message, so I’m not sure how it would apply to this case.
It seems like it’s something on the server side, perhaps something in the php.ini file? Or maybe the .htaccess file? I’ve never had this problem before with libraries or php scripts
once I’ve got them to work on localhost, so this is really strange to me.
EDIT/UPDATE:
I changed the file permissions from 644 to 755, but that didn’t do anything.
I changed demo.php to load a test file instead of linkedin_3.1.1.class.php and that worked fine, so it’s definitely not parsing just SOME files. Then I decided to try some of the earlier versions of the same library. Version 3.1.0 parses and runs without error. Version 3.2.0 does not parse, although the parse error is different from version 3.1.1. That’s strange because the download count is 752 for v3.2.0, so how could it not work for me if it worked for hundreds of other people?
Anyways, I’m going to work with v3.1.0 for now and see if anyone can solve the mystery of why all the versions after v3.0.0 get parse errors. I’ve logged an issue with my hosting provider, as well as on the project page.
HTTP Error 500 Internal server for php pages and solution
Generally, to solve this problem you need to take help of log files located at following location:
This error only occurs because of web server software. However after looking through logs you may not find many details. This problem may be caused by:
4.Missing php.ini (or cannot read php.ini file)
In most case it is an invalid .htaccess directive. However recently I came across a web server w/o /etc/php.ini file. A long time ago I setup this server )Apache chrooted jail). So you need to maintain two files one outside jail and another inside jail:
Many scripts open this file on fly to get correct configuration directives. If this file not found you get error 500. It took some time to figure out this problem. Finally strace helped me out to debug this problem.