Jump to content

[SOLVED] Local PHP issues


mnybud

Recommended Posts

You should try to avoid using short tags (<? ?> <?= ?>) within your scripts. Short tags are depreciated and are not recommended. Hence why they are disabled by default. You should note they are soon to be removed completely as of PHP6.

 

I would highly recommend you to convert your scripts to use the full PHP tags.

 

However you can enabled them by setting the short_open_tag directive to On within your php.ini

If you do a search and replace of <?= to <? echo followed by a search and replace of <? to <?php your problem will be solved and your code will work on any server. Sooner or later you will end up on a server where you won't have the ability to turn on the setting.

 

Php.net made a blunder when they created a second tag that defines where code starts and an even bigger blunder when that tag could be turned off. The tag that defines what code is should be unique and should always work.

If you do a search and replace of <?= to <? echo followed by a search and replace of <? to <?php your problem will be solved

 

And that could be done to every file ending with the extension .php on a Linux machine using....

 

find . -name '*.php' -exec sed -e 's/<?=/<? echo/g' -e 's/<?/<?php/g' {} \;

 

edit: eww, that broke the


tags.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.