Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Basic PHP problem


ghost's Avatar
0 0

This is proabably something completly wrong but…

I'm just starting in php and when i made a script and saved it as ansi.php and put it as the url it brought up the text file. How do I fix this?

<?php echo "the time is"; echo date( 'H:i:s' ); ?>


Mr_Cheese's Avatar
0 1

your server probably doesnt allow php.

fix it by moving to a new server with php.


ghost's Avatar
0 0

Alright, this is because PHP is a server side language. So you need to host it on something like apache with php enabled. Or go to freehostia.com or 110mb.com get an account and host your scripts there. The reason that it doesn't work with your browser is because your browser can't interperate .php files. And this all brings it back to because php is a server side language, and stuff like javascript is client side. So yea, hopefully that helped. I may have just ended up in confusing you more….. Ah well, hopefully that helped somewhat. For now just get a freehostia account and host your files on that.

EDIT: Ah, you beat me to it Mr. Cheese!


ghost's Avatar
0 0

does your server support php?

EDIT: Holy shit when i started typing this there were no replys…


ghost's Avatar
0 0

lol thanks guys im gonna download apache


ghost's Avatar
0 0

Oblivion, there's a GREAT article on here about setting up apache with PHP, cause I tried to set up php for mine on my own n' messed it up : X, so just search in articles for setting up apache with php.


ghost's Avatar
0 0

for as far as I remember, setting up php and apache manually is a real pain! Google for wamp, it installs and configures everything in a minute so ur set to code the hell out of it. :D GL


What_A_Legend's Avatar
...Legend?
0 0

I tried setting up PHP and apache on my local machine and struggled to get it running, but after prowling around the Internet i found a very useful installer which installed all of these different aspects with a simple step by step installation (basically all you do is press next), if i was you i would do the same.

This tool known as XAMPP was highly useful or you could alternatively use EasyPHP.

Personally I would recommend XAMPP part of apache friends link is below : http://www.apachefriends.org/en/xampp.html


ghost's Avatar
0 0

well i installed xampp…but I dont understand how it will help me run php scripts. Im currently running apache and I went to internet explorer typed in ansi.php and i got notepad again. Do I have to use a different browser or something?


What_A_Legend's Avatar
...Legend?
0 0

Unitstall every thing you got including apache as apache is included in the XAMPP package, then re-install the xampp aplication. Make sure you save all files you create in the folder named htdocs in the xampp program file, may want to mkae a shortcut to it on your desktop.

When you have your PHP script saved in the htdocs folder go in to your browser and type in the url 127.0.0.1 and it will locate you to you local host. When in your local host all the files/folder within that folder will be listed and you can select your script and it shoud run. Inless theres a file in there called index.*** as that will automatically open up innitally.


AldarHawk's Avatar
The Manager
0 0

If you are looking for something oblivion please contact me. I can hook you up with some stuff…I am on MSN. Give me a message man…Aim works as well.