hi
am having a very weird problem on my website all php files when opened show the php file contents instead of running. any ideas?
http://ekramy.exofire.net/faq
please help me
hi
am having a very weird problem on my website all php files when opened show the php file contents instead of running. any ideas?
http://ekramy.exofire.net/faq
please help me
This issue is usually caused by a misconfigured server; if you're host is x10Hosting, submit a ticket. Otherwise, contact them. First, however, check that:
- You are using the .php extension for your index.php file
- Your host supports PHP
- If you have a .htaccess file, try renaming it and trying again, to make sure it isn't causing the problem.
Have you been editing .htaccess in ~/public_html/ or ~/public_html/faq? If so, what have you done? Post the actual configuration, not just a description of what you were trying to accomplish.
You can try re-enabling PHP processing with:
On an unrelated note, your script is wide-open to SQL injection. The best solution is to switch to the PDO driver and prepared statements (searching this forum or the web will provide more info).Code:AddHandler application/x-httpd-php5 .php
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.
@lucasjnjones :am hosting with x10hosting and i have done anything to htaccess files
@mission: i ddint do anything to htaccess files and i know about the injection attacks am just demoing the website now and can you please elaborate more on the reenabling of php processing where do i execute or use that code?
thank you both for your time
Remove the line
from your .htaccess file. Whatever/whomever put it there should not have.
AddType x-mapp-php5 .php
And try to keep your questions in one thread.
Last edited by descalzo; 12-28-2009 at 06:47 PM.
Nothing is always absolutely so.
Make sure they have the php tags inside. I do not see the <?php ?> tag on the faq page. Make sure the pages have the .php extension also.
You should give us more information. We don't know your experience with PHP, so we don't know if you are aware that you must keep your files within <?php ?> tags or that it must have a .php extention, or even that it must be on the server to be executed. Try pasting the source code of your PHP file, and the .htaccess file, with files names in the post and then we can help.
Last edited by Twinkie; 12-29-2009 at 12:15 AM.
The linked page has an opening <?php tag, which the browser tries to parse as an HTML tag, and an extension of ".php". The page is missing a closing ?>, though that's optional.
Anyway, Bryon already solved this problem. ekramy has been cross-posting.
Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.Misson, not Mission.