Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 8th, 2008, 10:37 AM
Jimmy Liew's Avatar
Newbie
 
Join Date: Apr 2007
Location: Malaysia
Age: 26
Posts: 8
Default PHP Script not execute but displayed as regular HTML documents

I have a problem executing my php scripts. The scripts displayed as regular HTML documet and not execute. When I view source, it display the full complete php source code I have in the server. I don't really sure whether the bugs is from IIS or php. So far, I have done all necessary steps in setting up php, and phpinfo() executed with no error found.

Kindly advice. Thank You.
Reply
  #2  
Old August 8th, 2008, 10:48 AM
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 305
Default

Do you have the php start and stop tags in place? <?php and ?>

Or it might be a server configuration problem, maybe your php engine isn't running.

By the way, it is a good idea from a security point of view to move most of your PHP code away from the html document tree, so something like this cannot happen. Given the right permissions on the directory folder, your PHP engine can read a file in from another location using "include" or "require" commands which the html server does not have access to. Just put code stubs in your document tree which "include" or "require" the actual script code from another location.
Reply
  #3  
Old August 8th, 2008, 10:57 AM
Jimmy Liew's Avatar
Newbie
 
Join Date: Apr 2007
Location: Malaysia
Age: 26
Posts: 8
Default

Quote:
Originally Posted by coolsti
Do you have the php start and stop tags in place? <?php and ?>

Or it might be a server configuration problem, maybe your php engine isn't running.

By the way, it is a good idea from a security point of view to move most of your PHP code away from the html document tree, so something like this cannot happen. Given the right permissions on the directory folder, your PHP engine can read a file in from another location using "include" or "require" commands which the html server does not have access to. Just put code stubs in your document tree which "include" or "require" the actual script code from another location.
Thanks for your help on this.

Yes, I have the php start and stop tags in place. The full source codes work fine on another web server. Is that anything I need to configure on IIS, since the IIS has some difficulty to compile the php scripts?

I have no problem to load the phpinfo(), does it mean that my php is working fine?
Reply
  #4  
Old August 8th, 2008, 11:33 AM
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 305
Default

I cannot help with IIS, I am using Linux, so I hope another forum reader can give you some advice here.
Reply
  #5  
Old August 8th, 2008, 10:52 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Age: 22
Posts: 2,790
Default

Hi.

Do you use the <?php ?> tags, or the shorter <? ?> version?
If you use the short-tag version, try the former.

You say phpinfo() works? If that is the case, your server does seem to have PHP loaded correctly. Which means this has to be a problem with your code.

Try putting a phpinfo() file in the same directory as your other code. See if that works.
Reply
  #6  
Old August 9th, 2008, 02:29 PM
kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,664
Default

Could be as simple as allowing the php we extension in IIS, but I'm not a php user. Try here:
PHP on IIS
Reply
Reply

Bookmarks

Thread Tools

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

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

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles