PDA

View Full Version : Newbie Problem


Grevorion
10-31-2005, 07:28 PM
Hey, there.

Trying to install PHP with Apache. Just recently started fiddling with PHP and in the book I have, the example of knowing that PHP is functional is by doing this:

<HTML>
<HEAD>
<TITLE>HEYA!</TITLE>
</HEAD>
<BODY>
<h1>Hello in PHP!</h1>

<?
print "Hello, world!";
phpInfo();
?>
</BODY>
</HTML>´

But the only output I get through my browser (using http://localhost etc.) is the HTML code only, the PHP program doesn't show at all. I am dumbfounded and was hoping that someone might know what's going on. Is it a setting I forgot to make? I have followed the instructions in the book and reviewed it over and over again, but no luck.

Thanks in advance.

bcarl314
10-31-2005, 08:10 PM
Hmm, a couple of things come to mind. I'd try these trouble shooting options...

1) Start / restart apache.
2) Don't use short tags (if php.ini is not set up right the <? ?> stuff won't work. Try <?php and ?> instead.
3) Do you see the php code when you view source?
4) Are you on Linux / Unix or Windows? I seem to recall there being problems with where you put the php.ini file on wintel systems.

Grevorion
10-31-2005, 08:25 PM
I have shut down and restarted Apache, without any changes. Still the same. I used the two tags you suggested, plus the <script language = "php"> one. None of them worked. And yeah, I see the code when I view the source. Running the server on Win2K Professional. And the manual I have said something about there being some trouble with the php.ini file, yeah. It said to put it in the C:/WINNT directory and I have. Any other places I should try to put it? Since my Apache install is on the D:/ drive.

Thanks for the quick reply!

Exis
10-31-2005, 09:12 PM
If you have room, you should try instaling into the C: drive

Grevorion
10-31-2005, 09:31 PM
Tried that and it didn't work.

JamieR
10-31-2005, 09:37 PM
If you're having problems installing apache etc one by one, consider downloading like XAMPP which contains apache, php, mysql, filezilla server, phpmyadmin etc and installs in one go.

missing-score
11-01-2005, 12:40 AM
Try putting PHP.ini in the apache installation directory, whether on C:\ or D:\. I have run apache, PHP and MySQL from the D:\ drive before and it has always worked fine for me.

Also ensure you have enabled PHP by adding the module to httpd.conf?

And like bcarl mentioned, do you see the PHP source code with the HTML when you view the page, or JUST the HTML.