Jump to content

php code show in the browser


Recommended Posts

hi..,

i have pc development, using win xp sp3, apache+mysql+php the code/ webpage work prefect.

i have intranet server, using ubuntu 10.04, apache+mysql+php the code/ webpage work prefect.

but.., when i copy to live web server, using win server 2008, apache+mysql+php, all php code show in broswer.

if there is a html code, it show correctly, but the php code, show just like text in the browser.

 

how to solve this problem?

thanks for any help/ info

 

Link to comment
https://forums.phpfreaks.com/topic/221606-php-code-show-in-the-browser/
Share on other sites

How exactly was php installed on the live server? it would seem it is misconfigured.

 

first, i install apache 2.2 installer

2nd, install mysql installer

3rd, install php installer (during process, select web server and loc of conf file)

that's all.

 

any file( *.dll) i should copy to some folder?

 

It would help if you showed what opening php tag you are using in your code.

 

after i put <?php ( before just <? ), it work properly.

since so many pages (more then 200) I need to update, any other way beside that update opening tag?

 

i just wonder, why apache+mysql+php in windows server 2008 need this opening tag?

my intranet server, using ubuntu 10.04, without that (<?php), the web page work properly.

This is why you should always write php code with the full <?php open tag syntax. If you didn't have control over the php.ini file, you'd be forced to go through and change all of the tags. Since you do have control over the php.ini file, you can change this line to On, and restart Apache.

 

short_open_tag = Off

It would take less than 5 minutes using a programming editor like notepad++ to globally search/replace all the files in your project's folder (using the replace in files menu) and you will never have this problem again. You have probably spent 4-5 orders of magnitude more time on this problem already than what it would take to fix it.

 

Search and replace -

 

1) <? to <?php

2) <?phpphp to <?php

3) <?php= to <?php echo

4) Done!

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.