 | 
August 8th, 2008, 10:37 AM
|  | Newbie | | Join Date: Apr 2007 Location: Malaysia Age: 26
Posts: 8
| | 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.
| 
August 8th, 2008, 10:48 AM
| | Needs Regular Fix | | Join Date: Mar 2008
Posts: 305
| |
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.
| 
August 8th, 2008, 10:57 AM
|  | Newbie | | Join Date: Apr 2007 Location: Malaysia Age: 26
Posts: 8
| | 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?
| 
August 8th, 2008, 11:33 AM
| | Needs Regular Fix | | Join Date: Mar 2008
Posts: 305
| |
I cannot help with IIS, I am using Linux, so I hope another forum reader can give you some advice here.
| 
August 8th, 2008, 10:52 PM
|  | Moderator | | Join Date: Nov 2006 Location: Iceland Age: 22
Posts: 2,790
| |
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.
| 
August 9th, 2008, 02:29 PM
|  | Moderator | | Join Date: Dec 2006
Posts: 4,664
| |
Could be as simple as allowing the php we extension in IIS, but I'm not a php user. Try here: PHP on IIS |  |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | 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.
|