Page 1 of 1

[solved]Php scripts will not run on Apache

PostPosted: 25. June 2012 23:53
by bluelantern1163
Not sure if this is the correct place to ask the question, but I will start here:

I run my site on the localhost, and use firefox to view the site.

I have a small form on the page, a simple username and password box that will store information on the MySQL database. I use a php script to run the storing of data on the MySQL database. However, when I fill in the fields and click submit, it does not run the script, it makes the page go blank and nothing happens, and the address bar says "file:///C:/xampp/htdocs/runscript.php". I know the script does not run, because the MySQL database where I told the script to store the information is empty. However, when I run the script by directly typing in "http://localhost/runscript.php" it will run the script (not properly, because it is missing the fields).

What is wrong, and how do I fix it?

bluelantern1163

Re: Php scripts will not run on Apache

PostPosted: 26. June 2012 04:37
by Altrea
Hi bluelantern1163 (if you start a new thread it would be very polite to start with a hello),

The difference between HTML and PHP is that HTML can be rendered in the browser. PHP needs a webserver to be processed before.
That does not happen for your script, because your browser don't have any clue that there is a webserver at your computer which needs the script first.
It all matters on the Request-Address your browser gets.
I have explained it a little bit more detailed here: viewtopic.php?f=16&t=50681&p=195077#p195077

What you have to do is to correct the action attribute of your form.

best wishes,
Altrea

Re: Php scripts will not run on Apache

PostPosted: 26. June 2012 08:41
by bluelantern1163
My bad, I should have given at least a greeting; I normally do, it just slipped by me this time.

That solved the issue Altrea, it took a little fiddling, but I got it to work, thanks for the help

Re: Php scripts will not run on Apache

PostPosted: 26. June 2012 15:03
by Altrea
I'm glad you got it working :)

I marked your topic as solved.

best wishes,
Altrea