Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP execution question

Options
  • 23-10-2007 9:47am
    #1
    Closed Accounts Posts: 199 ✭✭


    Hi

    I'm having a bit of a problem with some of my php code not executing.

    What happened is that I downloaded an opensource php application and set it up on a local xampp server on my XP machine. It ran fine, no problems.

    So I then moved to my linux host environment, but none of the code executed initially.

    so i looked into the code, and by replacing all the <? tags with <?php it started to execute.

    Even after doing this there are still parts of my code not executing on my hosts environment, e.g. <li><a href="<? echo $homeURL; ?>">Home</a></li>

    even if i replace the <? with <?php it still won't execute.

    I am using php5.2 in both environments.

    can anyone help me with this? I guess there is some configuration different on the linux side, ideally I'd like the <? syntax to execute.


    Thanks

    B2


Comments

  • Registered Users Posts: 568 ✭✭✭phil


    What opensource PHP application is this? No PHP application should ever be distributed with the short tags <? variants.

    The reason for this is that this mnemoic is also used in other places (most commonly XML).

    However, if your host allows you to set configuration variables via .htaccess files, you should be able to change this for your site.

    Create a .htaccess file and insert the setting:
    php_value short_open_tag "On"
    

    or
    php_value short_open_tag 1
    

    http://ie2.php.net/manual/en/ini.core.php

    Phil.


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    you give this example
    [php]
    $homeURL = "http://www.yourdomain.com";

    <li><a href="<?php echo $homeURL; ?>">Home</a></li>

    //but is $homeURL defined?
    [/php]


  • Closed Accounts Posts: 199 ✭✭Beta2


    Thanks !!
    ; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.
    ; NOTE: Using short tags should be avoided when developing applications or
    ; libraries that are meant for redistribution, or deployment on PHP
    ; servers which are not under your control, because short tags may not
    ; be supported on the target server. For portable, redistributable code,
    ; be sure not to use short tags.
    short_open_tag = On
    

    I changed this entry in the php.ini file, from off, to on.

    I see what you mean about the code being distributed with short tags, I drop an email to the lads, its early days for this application.

    Thanks for all your help :D


  • Registered Users Posts: 568 ✭✭✭phil


    Ah you control the server... I presumed you were on a shared hosting environment of some kind. Yes, changing that setting in php.ini is exactly the same (except of course it applies on a site-wide basis).

    Phil.


Advertisement