Page 1 of 1

PHP does not seem to be working (Win 7 64) 1.7.7 [SOLVED]

PostPosted: 29. December 2011 10:10
by mitesh
Hi

I'm using Windows 7 64 bit with XAMPP 1.7.7

According to XAMPP control panel Apache and MySql are running. When going to http://localhost/xampp/ the status shows:
MySQL database, PHP, HTTPS (SSL), Common Gateway Interface (CGI) and Server Side Includes (SSI) all to be ACTIVATED.

When running:
Code: Select all
<html>
<head>
<title>Hello in PHP</title>
</head>
<body>
<h1>Hello in PHP</h1>
<?php
print "Hello, world!";
phpInfo();
?>
<body>
</html>


I see Hello in PHP on the page, which tells me that the page loads, but not the PHP section. The file is stored in C:\xampp\htdocs I have tried this on 2 Windows 7 64bit PCs, but have the same result.

Any help would be appreciated.

thanks

Re: PHP does not seem to be working

PostPosted: 29. December 2011 10:15
by Sharley
What file extension does your Hello World file have?

Because it contains php code then the extension needs to be .php so the server knows to parse the code.

For example:
http://localhost/helloworld.php

Your browser translates the html code and the Apache server parses the php code but Apache needs to know the file contains php so the mixed html and php code needs to have a php file extension.


Everything else is looking good. :)

Re: PHP does not seem to be working

PostPosted: 29. December 2011 10:24
by mitesh
sorry, forgot to mention. The extension is .php

I was wondering if it had to do with my OS. I have disabled firewalls, and have followed the default XAMPP installation, but no luck with the PHP side of things :(

Re: PHP does not seem to be working

PostPosted: 29. December 2011 10:31
by Sharley
XAMPP works quite well in Win7 64 bit OS.

For future reference to test php is working type in your browser:
http://localhost/xampp/phpinfo.php

BTW, I just tested your code and it works fine in my installation either lower case or with the capital I in phpinfo() so your issue may not be related to case.

See if you can access the above page.

Because you can access the Welcome page at http://localhost/xampp then php is working fine.

What have you named your hello world php file?

Re: PHP does not seem to be working

PostPosted: 29. December 2011 11:07
by mitesh
I can access http://localhost/xampp/phpinfo.php

I had my file named test.php

I have now saved it as helloworld.php but same result.

Re: PHP does not seem to be working

PostPosted: 29. December 2011 11:10
by Sharley
What text editor did you use?

When you saved the file you created did you use Any file (*) or did your text editor add a txt extension so you have helloworld.php.txt ?

Make sure that in your Windows settings you have show hidden and known file types as the .txt may well be hidden.

Re: PHP does not seem to be working

PostPosted: 29. December 2011 11:24
by mitesh
I'm using Notepad++. Changed file extension to PHP. WIndows is set to view file extensions and it is .php (no .txt at the end)

Re: PHP does not seem to be working

PostPosted: 29. December 2011 11:32
by Sharley
Well, I am at a loss now to know what the problem is.

XAMPP is working fine as you can access the php pages without issue.

Your code works for me without problems.

Your text editor is one I recommend and your Windows is configured correctly.

What's left, the browser?

Clear your browser's cache of temporary files and try again so you are being served a fresh page.

Silly question but you are typing in your browser
http://localhost/helloworld.php
and not just double clicking on the helloworld.php file in the htdocs folder?

Re: PHP does not seem to be working

PostPosted: 29. December 2011 11:37
by mitesh
:oops: :oops: :oops: :oops: :oops: :oops: :oops:

I was double clicking the file

typed in path and it works :)

THANK YOU!!!!! :D

Re: PHP does not seem to be working

PostPosted: 29. December 2011 11:40
by Sharley
You're welcome and thanks for the feedback. 8)

I am pleased that you can now move forward. :)

Good luck. :)