TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-22-2009, 12:32 PM   #1 (permalink)
skv
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
skv is on a distinguished road
Confused PHP Tags Issue..

Hi Experts,

I have just started learning PHP today, and my initial task is to port a PHP application from a Production Linux Box to a development Windows Box.

I was able to install and configure apache, php and mysql.

The application is up and running, but some of the actual code start appearing in the PHP page in the browser.

I was wondering if there was a difference between the PHP parser in windows and linux..

From my initial troubleshooting it seems to be something to do with tags..

Please suggest...
skv is offline  
Reply With Quote
Old 06-22-2009, 01:09 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Experts? We is experts!

It may be the case that your PHP is configured to not support short PHP tags -- the <? ones. The standard PHP tag is <?php, however, many people will still add <? to their code thinking that is the standard.

Try the following 2 lines of code and see what occurs:

php Code:
<?php echo 'Does this get displayed as PHP or HTML?'; ?>
<? echo 'Does this get displayed as PHP or HTML?'; ?>
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-22-2009, 01:14 PM   #3 (permalink)
skv
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
skv is on a distinguished road
Default

Hi WildHoney..

The <?php works fine, but the <? doesn't ....
skv is offline  
Reply With Quote
Old 06-22-2009, 01:46 PM   #4 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

Did you restart the server after you changed the .ini? It would need to be restarted in order to reload the settings (and in turn pick up your new settings).
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-22-2009, 01:48 PM   #5 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

P.S. This might help if you need to restart Apache

http://www.informit.com/articles/art...26130&seqNum=5
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-22-2009, 02:30 PM   #6 (permalink)
skv
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
skv is on a distinguished road
Default

There was no effect even after restarting apache. However replacing some <? tags with <?php tags did the trick..
skv is offline  
Reply With Quote
Old 06-22-2009, 02:38 PM   #7 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default

It sounds to me like you either haven't edited the PHP.ini correctly or you haven't edited the correct file.

Create a new file with
php Code:
<?php phpinfo(); ?>
and load this in your browser. It will tell you the location of the PHP.ini to edit. See if it points to the same location as the PHP.ini file you edited.
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
Old 06-22-2009, 02:42 PM   #8 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Then maybe check any .htaccess files to see if they are blocking the short tag. It may also be that your "short_open_tag=off" has a ";" before it (commenting it out).
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 06-22-2009, 01:29 PM   #9 (permalink)
skv
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
skv is on a distinguished road
Default

I looked up php.ini file and found this "short_open_tag=off"

I changed it to "on". But the issue still persists...
skv is offline  
Reply With Quote
Old 06-22-2009, 01:31 PM   #10 (permalink)
skv
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
skv is on a distinguished road
Default

Could there be anything specific to the OS..?
skv is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
file_get_contents with PHP tags hello-world Absolute Beginners 4 03-30-2009 08:32 PM
PHP Namespace Issue - What do you guys think? Wildhoney The Lounge 7 10-28-2008 02:34 PM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
Designing a tagging system Alan @ CIT Advanced PHP Programming 4 03-10-2008 03:25 PM


All times are GMT. The time now is 11:05 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design