Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP error, TGP script

6:10 pm on Jun 14, 2012 (gmt 0)

New User

joined:Mar 5, 2012
votes: 0

I just installed a Thumbnail Picture Gallery program, and I get the following error after I try to use one of the functions (Build Page command):

Invalid server response

Parse error: syntax error, unexpected $end in /home/my_user_name/public_html/tgp/tgpx/includes/common.php(559) : eval()'d code on line 1
{"status":"Success","message":"The selected TGP page has been built"}

File was uploaded in binary mode (as required), permissions are set correctly, and there is a server-test.php file, which passes the test 100%. I checked for opening and closing tags, and nothing is missing, and I am not sure what would be the next steps in trying to figure out how to fix the issue.

I have some knowledge of PHP, and I can edit the code, but the file is 3000 lines long, and it is an advanced program with a lot of functions, variables etc, so it doesnt look like something easy to do etc.

If possible please let me know what is the best way to get around this one, and how to solve other potential errors in the program.

Thank you.

# # # Edit # # #

I checked common.php and all included .php files for number of opening and closing curly braces, and they all match (so it doesnt look like there is something missing).

# # # Edit 2 # # #

This is the code:

4:37 pm on June 15, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

Well, an unexpected $end is most likely a missing bracket. I'm a little concerned about

uploaded in binary mode (as required),

PHP scripts are by nature text files, that's all they are, and it's possible binary mode has done something funky with the line returns. Used to have this problem all the time with Perl scripts, and editors that are not Unix compatible.

Have you tried re-uploading it using ASCII?

Another possibility is something is screwy in your upload, for example, the file didn't transfer completely and is cut off at the end. You can play around with Passive/Active mode in your FTP, and if you have a way, view the file actually on the server via SSH or maybe even a cPanel file manager.

Last is if you've edited anything, do NOT use MS Word or any rich editor for this, it will convert your quotes to smart quotes and really hose you up. Edit the originals in something like NotePad (or SimpleText for Mac.)

edit: Heh. Curious I ran this script and look at line 1446:

$options['tag_attributes'] = str_replace(array('"', '''), array('"', "'"), $options['tag_attributes']);

See the three single quotes in a line? I got an error there (not a $end error.) Note usre of this line's intention but if it's trying to remove (don't think so) it would be

$options['tag_attributes'] = str_replace(array('"', ''), array('"', "'"), $options['tag_attributes']);

or if it means to replace them it would be

$options['tag_attributes'] = str_replace(array('"', "'"), array('"', "'"), $options['tag_attributes']);


$options['tag_attributes'] = str_replace(array('"', '\''), array('"', "'"), $options['tag_attributes']);
In any case, three in a row is an error.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members