[solved]Php scripts will not run on Apache

Problems with the Windows version of XAMPP, questions, comments, and anything related.

[solved]Php scripts will not run on Apache

Postby bluelantern1163 » 25. June 2012 23:53

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
bluelantern1163
 
Posts: 31
Joined: 17. June 2012 02:18
Operating System: Windows 7

Re: Php scripts will not run on Apache

Postby Altrea » 26. June 2012 04:37

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Php scripts will not run on Apache

Postby bluelantern1163 » 26. June 2012 08:41

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
bluelantern1163
 
Posts: 31
Joined: 17. June 2012 02:18
Operating System: Windows 7

Re: Php scripts will not run on Apache

Postby Altrea » 26. June 2012 15:03

I'm glad you got it working :)

I marked your topic as solved.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 115 guests