Jump to content

Recommended Posts

Here at work we just updated to PHP 5.2.1 on our test server.  Testing out the web page on there, for some reason the PHP scripts are all breaking.  We are getting errors sent back to us from PHP saying it has found an "unexpected $end".  Depending on the file it could occur at the very end of the file, or even in the middle of the file.  Not sure exactly what is causing this problem.  Anyone had this same problem after upgrading to 5.2.1?

Link to comment
https://forums.phpfreaks.com/topic/45624-problems-upgrading-to-php-521/
Share on other sites

I have done some more research since posting that first post, and I have found some interesting things.  By reading a thread on phpbuilder, I discovered that most people receive this thread because of their carelessness and they leave out curly brackets.

 

This cant be our problem, however.  We have been using this code faithfully for a long time now, and have received no such errors in the past...surely those would have already been caught since our code has been running on production servers for quite a long time.

 

The other case where people seem to be receiving this error (a bit less common) is in their php configuration (php.ini file), the short_open_tags flag is not turned on.  In other words, the server is set to not be able to recognize short open tags, or <? tags.  But only <?php tags.

 

I decided that this could possibly be our problem, and so I checked out the php.ini file, only to find that short_open_tags was set to the value "On"...so they should be allowed perfectly fine.  After toying around with the code...I place "<?php" tags in place of all "<?" tags...and suddenly things worked...which is odd considering that short_open_tags was enabled.

 

With that in mind...if I make a very simple php file:

 

<?
print 'Hi!';
?>

 

with short open tags...it works...

 

So I know the problem seems to be with short open tags....but I cannot pinpoint it exactly.  Under that new light and knowledge...any advice?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.