Page 1 of 1

I can't run my code normally

PostPosted: 22. January 2011 17:28
by php_newbie
I'm using the latest version of Xampp installer for windows, and I use it on windows 7.
The Apache's service is running normally, but my code can't running in my browser (I try using firefox 3.6 Beta 3 and IE).

This is my code :

Code: Select all
<?php
?>
<HTML>
<HEAD></HEAD>
<BODY>
<?
   echo("Hello word!");
   echo("Hello word!");
?>
</BODY>
</HTML>
<?
?>


I created it under F:\xampp\htdocs\learning01.
I call it in my browser using localhost/learning01, but it shows nothing, just blank.
Can everybody give me a hint ? thanks a lot. I'm sorry for my english.

Re: I can't run my code normally

PostPosted: 22. January 2011 17:42
by Altrea
Does your file have a .php file extension?
Is your Apache really started (green running sign next to Apache in the XAMPP control panel)?
Can you request the XAMPP Backend ( http://localhost/xampp/ )?

Re: I can't run my code normally

PostPosted: 22. January 2011 22:33
by peterwt
Try

Code: Select all
<?php
?>
<HTML>
<HEAD></HEAD>
<BODY>
<?php
   echo("Hello word!");
   echo("Hello word!");
?>
</BODY>
</HTML>
<?php
?>

and the file name should be learning01.php.

But all you need is

Code: Select all
<HTML>
<HEAD></HEAD>
<BODY>
<?php
   echo("Hello word!");
   echo("Hello word!");
?>
</BODY>
</HTML>


Peter

Re: I can't run my code normally

PostPosted: 23. January 2011 03:21
by manolo34
I have a similar problem, but in my case I have a file located at htdocs, named "prueba.php"; when I try to run it I type "localhost/prueba.php" and IE returns Not found
Error 404
localhost
22/01/2011 07:54:48 p.m.
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

I am just learning php and installed xampp for windows, so I tried uninstalling xampp and installing it again, but it didn't work.

Any suggestions?

Re: I can't run my code normally

PostPosted: 23. January 2011 04:35
by Altrea
Your problem is NOT similar to the original poster.

Which Editor do you use to create your PHP files?
If you use Windows Notepad, be sure your file will be saved as prueba.php and NOT prueba.php.txt.

Re: I can't run my code normally

PostPosted: 23. January 2011 20:09
by manolo34
I am using Windows Notepad, and checked the extension (which is normally hidden), and you were right!!

I removed the ".txt" and it worked!

Thanks a lot for your support.