Hello and Good day.

I wanted to create a simple login / logout script in php. I have tried/copied all the available tutorials here in the web but I seem to have the same problem to all the scripts. Everytime I hit the login button i get redirected to a page where I could see the source code(login.php), in chrome. In mozilla, it asks me to open/download the script.

I appreciate any help from you.
Thank you =)

Recommended Answers

All 4 Replies

Make sure your server or localhost can parse php.

try this, save as anyNameYouWant.php, upload to your server or save to your localhost public directory.


 echo "Hello World";


Direct your browser to this file..The above should be printing "Hello World on your browser. If not, then your server does not support php.

Another thing is to check all of the files relevant to the login script and make sure they all have the extension .php or other extensions the php parser supports e.g. .inc, .tpl, and others.

Thank you for the reply veedeoo.

I'm not sure if my server supports php. im using xampp btw.

I tried what you told me, still instead of just "Hello World" the whole script is what is outputted.

Where can I find exactly the localhost public directory? is it the htdocs in xampp?
Is it wrong to just save my php file anywhere, in the desktop for example?


Ok... go to the location where you installed your xampp.. Normally this is located in c:xampp.. Open this directory and find the xampp_start . Click on the xampp_start icon. This should fire up and start the xampp.

The second alternative is to just click on the xampp icon on your desktop. This should start the xampp control panel. Open the control panel and make sure that the services are on.

Once the services are confirmed to be running, open your browser, and then type localhost.. this should take you to xampp index page.

Remember, in order for you to view the parsed output of php files on the browser, these files should be saved inside the htdocs directory.

Thank you very much.

the main problem was that I did not store my files in htdocs and the way I access it in the address bar was wrong.

problem solved. =D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.