AppleTattooGuy
AppleTattooGuy

Reputation: 1175

PHP syntax error showing since moving to new server

I have just transferred my site over to a dedicated server and all was working fine before but since moving to the new server, all pages seem to be fine except for 1 thats giving me a white screen. A check on the error log says PHP Parse error:

syntax error, unexpected '}' in /home/ftp1/www/yp_admin/products.php on line 112

This is line 112

} while ($row_subcategories = mysql_fetch_assoc($subcategories));

and the complete section of the code is

<? if (isset($_GET['catid'])) {

            $scatid1 = $_GET['scatid'];

            do { ?>
                <div class="div"><a <?php if ($row_subcategories['id'] == $scatid1) { echo('style="color:orange;"'); } ?> href="?view&catid=<?php echo($catid) ?>&scatid=<?php echo($row_subcategories['id']); ?>"><?php echo($row_subcategories['sub_category']); ?></a><span><a href="?new&catid=<?php echo($catid); ?>&scatid=<?php echo($row_subcategories['id']); ?>"> New Product</a></span> </div>
                <?php } while ($row_subcategories = mysql_fetch_assoc($subcategories));


                } else { 

                do { ?>
            <a href="?catid=<?php echo($row_categories['id']); ?>">
                <div class="div"><?php echo($row_categories['category']); ?></div>
            </a>
                <?php } while ($row_categories = mysql_fetch_assoc($categories));}

                ?>

It was working completely fine before an I cannot find any errors, Have any of you come across this before?

Thanks in advance for your help.

FYI I am running CentOS with Apache server

Upvotes: 0

Views: 109

Answers (3)

zambesianus
zambesianus

Reputation: 1249

Probably on your old server you had default settings for short_open_tag.

You need to enable short_open_tag = 1 on your php ini file. Because your new server has this setting turned off.

Upvotes: 2

Vivek Sadh
Vivek Sadh

Reputation: 4268

Replace:-

<? if (isset($_GET['catid'])) {

with

<?php if (isset($_GET['catid'])) {

In your old server php.ini file must have been configured in such a way so as to allow short tags.

Upvotes: 1

Voitcus
Voitcus

Reputation: 4456

Try to start your opening tag in the very first line with <?php instead of <?. Short tags are now disallowed.

EDIT More reading in the manual

Upvotes: 5

Related Questions