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
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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

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.