Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please help.? My Wamp server not recognizing short open tags in php files.

    Im using wamp server in my pc which is running on window 7, I have created some php files using php short tags inside it, but when ever I run a file it always show me error. Please suggest me what to do.?

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,043
    Thanks
    2
    Thanked 316 Times in 308 Posts
    What errors are you getting? This might not have anything to do with the short open tags.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    ^
    This.
    PHP short open tags is a directive in the PHP.ini file. Simply set short_open_tag to 1 (which it is by default btw). Note that that will cause issues with the use of XML files though.

    However, not having it enabled should generate no errors UNLESS you are using mixed short and long tags and short is disabled. Ie:
    PHP Code:
    <?php

    if (true)
    {
    ?>
    <h1>Hello world!</h1>
    <?
    }
    Which should generate a parse error.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #4
    New Coder
    Join Date
    Apr 2013
    Posts
    39
    Thanks
    2
    Thanked 2 Times in 2 Posts
    i will suggest you change your short tag <? to <?php. if you must use it you may need to enable it in php ini file

  • #5
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks to all for sharing your suggestions i have solved my problem by just change PHP.ini file settings. thanks again

  • #6
    New Coder
    Join Date
    Apr 2013
    Posts
    39
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by williampritchar View Post
    Thanks to all for sharing your suggestions i have solved my problem by just change PHP.ini file settings. thanks again
    Great to hear your problem is solved

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,640
    Thanks
    0
    Thanked 649 Times in 639 Posts
    It is recommended NOT to use short tags because there are other commands that use that construct that are not PHP and which can appear in web pages.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •