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

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

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

Postby mitesh » 29. December 2011 10:10

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
mitesh
 
Posts: 5
Joined: 29. December 2011 09:26
Operating System: Windows 7 64bit

Re: PHP does not seem to be working

Postby Sharley » 29. December 2011 10:15

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. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: PHP does not seem to be working

Postby mitesh » 29. December 2011 10:24

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 :(
mitesh
 
Posts: 5
Joined: 29. December 2011 09:26
Operating System: Windows 7 64bit

Re: PHP does not seem to be working

Postby Sharley » 29. December 2011 10:31

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?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: PHP does not seem to be working

Postby mitesh » 29. December 2011 11:07

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.
mitesh
 
Posts: 5
Joined: 29. December 2011 09:26
Operating System: Windows 7 64bit

Re: PHP does not seem to be working

Postby Sharley » 29. December 2011 11:10

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: PHP does not seem to be working

Postby mitesh » 29. December 2011 11:24

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)
mitesh
 
Posts: 5
Joined: 29. December 2011 09:26
Operating System: Windows 7 64bit

Re: PHP does not seem to be working

Postby Sharley » 29. December 2011 11:32

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?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: PHP does not seem to be working

Postby mitesh » 29. December 2011 11:37

:oops: :oops: :oops: :oops: :oops: :oops: :oops:

I was double clicking the file

typed in path and it works :)

THANK YOU!!!!! :D
mitesh
 
Posts: 5
Joined: 29. December 2011 09:26
Operating System: Windows 7 64bit

Re: PHP does not seem to be working

Postby Sharley » 29. December 2011 11:40

You're welcome and thanks for the feedback. 8)

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

Good luck. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 84 guests