Page 1 of 1

I can’t get PHP to run/display. [SOLVED]

PostPosted: 07. March 2012 22:48
by Shazazzily
I have installed XAMPP 1.7.7 on my PC with Windows 7 Professional. As the XAMPP Status reports, the top 5 components, including PHP, are activated.

In C:\Program Files\XAMPP\htdocs, I have an Index.html file that includes a simple PHP echo command. I’ve also tried the phpinfo. None of the PHP works, though the HTML does show up in my browser.
Code: Select all
<?php echo "Howdy!"; ?>
<?php phpinfo(); ?>
It seems like my problem should be very simple to solve, but I’m at a loss. Is there some other setting in one of the config files I need to change?
~~~~~~~~~~
I have read a lot of help and had been trying much more complicated things, for example, working from my own web development directory and setting the DocumentRoot in httpd.conf file, accordingly.

But since none of the things I tried worked (and I could not get any help in other places), I backed everything out, uninstalled the previous Apache, and then started over with a fresh XAMPP installation. I’m now trying the simplest thing I can imagine, and I can’t even get that to work. I would very much appreciate some help.

Re: I can’t get PHP to run/display.

PostPosted: 07. March 2012 23:08
by Sharley
First to check your XAMPP installation is good type in your browser (if you have already renamed or deleted the existing index.php file):
http://localhost/xampp/index.php
and see if you reach the Welcome (Admin) page after selecting your language then exercise the demos in the left menu frame.

If all that comes up good then you have an issue with your own file and it should be accessed in much the same way if you placed it in the htdocs folder:
http://localhost/yourownindexfile.php
it must have a php extension if the file contains both html and php so the server knows to parse the php component.

So you will have to delete or rename the existing index.php file or your own index.php to yourownindexfile.php

Access for php files must go through the server and will not parse the server side php part if simply accessed from Windows Explorer.

Good luck. :)

Re: I can’t get PHP to run/display.

PostPosted: 07. March 2012 23:49
by Shazazzily
Yes, I get the Welcome (Admin) page from http://localhost.

Okay, I finally got a snippet of my own PHP code to run. Hallelujah! Praise the Sharley!

I guess it was working all along. Apparently mistakenly, I thought that PHP code would work inside a .HTML file. But it’s the other way around.

I’ll see what I can figure out from here. At least I took a baby step with your help. Thanks!