PHP files don't seem to work properly inside localhost

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

PHP files don't seem to work properly inside localhost

Postby Pano » 08. December 2010 01:19

Hi to all.

I have just installed xampp and try to create a Mysql database.
I'm using windows 7 64 bit.
I installed xampp succesfully and opened phpMyAdmin in order to create a database. I start by creating a table, adding information inside that table and saving it. Then creating 2 php files mysql.php and connect.php .

mysql.php looks like this:

Code: Select all
<?php

require("connect.php");

?>

and connect.php like this

Code: Select all
<?PHP


$connect = mysql_connect("localhost","root","password") or die("connection failed!");

echo "connected!";


?>


The problem is that when i try to run any of those two files, i get no response, just a blank page.

I tried to create an html file under same directory, just to check and it worked, but for a reason i can't get the php files to work. All files are under C:/xampp/htdocs , as they should.
Does anyone have a clue on that? Why php files don't run normally?

Thank you
Last edited by Pano on 08. December 2010 10:21, edited 1 time in total.
Pano
 
Posts: 3
Joined: 08. December 2010 00:49

Re: PHP files don't seem to work properly inside localhost

Postby Altrea » 08. December 2010 07:44

If you can use phpmyadmin, your Apache, MySQL and PHP are working.

How do you access/open the php file in your browser?
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: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: PHP files don't seem to work properly inside localhost

Postby Pano » 08. December 2010 10:00

To access the file i type http://localhost/mysql.php in browser address bar or http://127.0.0.1/mysql.php .
i also created a subfolder and placed both files in there http://localhost/firstdatabase/mysql.php which didn't change anything.
Pano
 
Posts: 3
Joined: 08. December 2010 00:49

Re: PHP files don't seem to work properly inside localhost

Postby Pano » 08. December 2010 15:52

sorry, my mistake
i used the windows notebook to write the code and saved it in unicode instead of utf-8. :evil:
thanks again
Pano
 
Posts: 3
Joined: 08. December 2010 00:49


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests