PHP downloading not executing
Posted by: yellek (---.lns20.adl2.internode.on.net)
Date: February 03, 2010 11:54AM

I have a site that works fine on a remote host but when I access it locally using WAMP the PHP files download without executing on the server. I can sucessfully execute PHPMyadmin so PHP is working.

Where should I be looking to determine the source of the problem as I'm stumped at the moment?

Yellek

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: February 03, 2010 03:31PM

are u using localhost/filename.php to accecss?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: yellek (---.75.168.69.optusnet.com.au)
Date: February 03, 2010 11:20PM

[localhost] which is being mapped to index.php which then downloads. I'm not using the file of the hard drive but rather going through Apache.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: yfastud (Moderator)
Date: February 04, 2010 01:02AM


Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 11, 2010 12:59AM

Hello,

I have a similar problem to the person in the initial post.

I read the article in the suggested link [blog.jlbn.net] and my setup conforms to their guidelines.

I have two folders in my document root of WAMP (C:/wamp/www) - phptestfiles and currentwebsite.

In phptestfiles I have various simple scripts that I wrote to play around with. I can execute these scripts no problem. I simply type [localhost] and I get the default wampserver page. Here I can click on "phptestfiles" under "projects" and then I see my scripts which i can click on and they execute correctly. There is no index.php file in this folder.

If I click on "currentwebsite", however, I get the windows "File download - Security Warning. Do you want to save this file, of find a program online to open it?" Find, save, cancel. This folder is a copy of a site that is executing fine on a server. There is an index.php file in this folder. I can't execute this file even if I type "[localhost] - or any other script in that directory for that matter.

I hope you can give me some pointers.

Thanks,
Tim.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: February 11, 2010 01:09AM

maybe there are index.php.txt? and windows hides the .txt

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: yfastud (Moderator)
Date: February 11, 2010 01:53AM

Quote

This folder is a copy of a site that is executing fine on a server. There is an index.php file in this folder
edit or remove htaccess file winking smiley

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: bahamucio (---.s-lan.satnet-bg.com)
Date: February 11, 2010 08:06AM

I have same problem ... and I have tried all the methods above and still no good result.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: February 11, 2010 08:08AM

add me to msn.. stevenmartin99@hotmail.com

or skype stevenmartin99

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 11, 2010 11:30AM

Hello againa and thanks for your help so far.

> Steven Martin Said:
> maybe there are index.php.txt? and windows hides
> the .txt


I have "show hidden files and folders" set to true in my windows folder.

> yfastud said:
> edit or remove htaccess file winking smiley

I had already edited htaccess file to allow execution of php in html. I did this by adding:

AddHandler application/x-httpd-php5 .php (at the top of the file)
and
RemoveHandler .html .htm (and)
AddType application/x-httpd-php .php .htm .html (at the end of the file).

The above didn't seem to make any difference.

I also tried removing the .htacces file completely to see what would happen and got the following error message:
"Unable to include class:- C:/wamp/www//framework/core/registry.php"

Not sure what that means as that file does exist in that directory?

Thanks,
Tim.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: February 11, 2010 01:00PM

im not talking about hidden

in the folder options below hidden there is "hide file extentions for known file types"

unitick it


anyway
C:/wamp/www//framework/core/registry.php"

ur issue seems to be the // in the url

most likely uv included a / at the start of a url that you dont need

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 11, 2010 06:30PM

Sorry Steve, I misunderstood. "hide file extentions for known file types" is already unticked.

I see what you mean about the invalid "//" in the url. That was coming from DocumentRoot in httpd.config where I had entered "C:/wamp/www/". I changed this to "C:/wamp/www/" but I still get the same error message just without the "//". Error message now: "Unable to include class:- C:/wamp/www/framework/core/registry.php" .

Interestingly, if I change my DocumentRoot to "C:/wamp/www/currentwebsite" then the webpage loads although it looks like the style sheet isn't working and the links on the page don't work. So perhaps paths could be causing the problem? I noticed that a class variable in loader.php set DocumentRoot depending on whether the site as on a live server or test server so I corrected this to reflect my test environment but this hasn't corrected the problem.

I wonder if there other config files that need updating which I don't know about? Any suggestions would be greatly appreciated.

Thanks,
Tim.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: bahamucio (---.s-lan.satnet-bg.com)
Date: February 11, 2010 07:19PM

I have got problem solved guys ... its wamp bug or name it as you like. Just changed wamp ot .... and it works flawlessly !

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 11, 2010 07:23PM

What do you mean by "Just changed wamp ot..."

Thanks,
Tim.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 11, 2010 10:19PM

Hello,

Do you think this could be a bug then guys as bahamucio suggests? My friend has got the same website working on his laptop using xampp.

I have noticed that someone else has just reported the same problem in a new post.

I suspect it might still be a config setting. What do you think?
Thanks,
Tim,

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: February 11, 2010 10:24PM

no its nothing to do with wamp

add me to msn stevenmartin99@hotmail.com

or get teamviewer and ill fix it

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 1 time(s). Last edit at 02/11/2010 10:26PM by stevenmartin99.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 12, 2010 12:35AM

Hi Steve,

I've added you to msn. I'll download teamviewer too.

Thanks,
Tim.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: timski (---.zone9.bethere.co.uk)
Date: February 13, 2010 09:30PM

Thanks to Steven my issue has been resolved. As he predicted it wasn't a bug in wamp but a config setting.

He added "AddType application/x-httpd-php .htm" to httpd.congi in \bin\apache\Apache2.2.11\conf

Working fine now!
Thanks again Steven.

Options: ReplyQuote
Re: PHP downloading not executing
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: February 13, 2010 09:37PM

No problem ,
Again i just wanna state that its not recommended you parse all htm/html files through the php engine as this could slow down the server when there is no php to be parsed as would be normal in a htm/hmtl file


Timskis site was built for him, and they used htm for files with php and html files for files with no php hence why the line needed to be added.

This is not the norm so dont go and add this line thinking it will fix a similar sounding problem as it most likely wont.

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.