php works just not in html file ...

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

php works just not in html file ...

Postby pepe_lepew1962 » 24. November 2008 02:45

I was having problems getting my php under win xp to work when I made some changes. I copied the php.ini-recommended to windows and renamed it php.ini, then removed the ; on the ;extension=php_mysql.dll. I then added c:\xampp\php to the windows path and PHPRC to the environment. Re-booted and I can get the php files to load in explorer, but when I create a simple html file and put in the simplest of php codes, it does not process them. I have moved the html file everywhere but still can't get the php portion to work. This has to be something basic but beyond me. Can anyone help?

Posts: 2
Joined: 24. November 2008 02:31

Postby Sharley » 24. November 2008 02:58

Best to go back to the beginning and put everything back in XAMPP to the defaults - where did you see to do all that moving of the php.ini etc?
not anywhere in XAMPP of that I am sure.

Now the only php.ini file to edit is in .\xampp\apache\bin folder.

Uncomment only your known required extensions (not all of them) in that file only - save the php.ini file and restart Apache after editing.

http://localhost will go to a php Welcome Page with lots of demos to test your XAMPP installation.
Check out the phpinfo() link for the current Configuration file being used by Apache's php.

If you add php code to a coded html file then you will have to rename the file with a .php not an .html extension so that Apache knows to parse the php code.

Double clicking on a php file in Windows Explorer is not the way to go for a php file - it has to be parsed by a server as it is a server side language.

Your php and html files go in the DocumentRoot folder which on a default installation is the .\xampp\htdocs folder then the URI would be:

You can separate them if you wish by placing them in a folder in the htdocs folder.
then the URI would be:
http://localhost/yourfolder/yourphpfile.php (or yourhtmlfile.html no php code).

Get the idea?
Last edited by Sharley on 24. November 2008 03:25, edited 1 time in total.
User avatar
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

Postby pepe_lepew1962 » 24. November 2008 03:24

I changed everything to the original state. I am not double clicking any file in windows explorer, I meant that I am double clicking an .html file in internet explorer with php code and the php code doesnt run. All I am doing is trying some examples from a book. If that means writing everything into .php then okay. Thanks for the info.
Posts: 2
Joined: 24. November 2008 02:31

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 68 guests