Jump to content

short_open_tag = On, Why wont it work?!


daydreamer

Recommended Posts

I am trying to get my PHP code like this:

 

<?="Hello"; ?>

 

Instead of this:

 

<?php echo "Hello"; ?>

 

Ive changed line 131 in my php.ini config file, to

 

short_open_tag = On

 

I have done this, reloaded my php/apache server, but it still wont use the code. no error, but no output.

 

I am using wamp server on my desktop to test it.

 

Is this the right file I should be editing: C:\wamp\bin\php\php5.2.5\php.ini ?

Link to comment
Share on other sites

Thanks.

 

this is the one i was supposed to be using:

C:\wamp\bin\apache\apache2.2.6\bin\php.ini

 

I am following a tutorial in a book, and hes using short tags.

 

Eventually I will want to upload my php to a propper hosting server.

 

Can you use short tags on them, or change the php.ini settings on your hosting account?

Link to comment
Share on other sites

Short open tags result in code that is not portable between servers and you won't always have the ability to turn the setting on.

 

If you want to write code that will always work and you won't need to go back and change it, always use <?php and <?php echo instead of <? and <?=

 

[Note: to php.net. Short open tags were a bad idea (look how much wasted time and non working code they have caused) and should be removed in php6, along with all the other multi-way settings that have nothing to do with configuring php on any specific server.]

Link to comment
Share on other sites

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.