Jump to content

PHP isn't behaving


Recommended Posts

Hello all,

 

I installed Apache 2.2.8 and PHP 5.2.5 on Win Xp SP2.

 

After installing Apache I got the "It Works!" message. I can get the phpinfo screen to show me all the goodies.

 

My problem lies in only PHP files are being processed. I can only get the phpinfo to come up if I point to test.php. The index (index.htm) file has a simple Hello World written as such:

 

<?
echo  'Hello World';
?>

 

which does not work. I'm pretty puzzled and frustrated here so any help is appreciated.

Link to comment
Share on other sites

Try using normal (proper) PHP tags, like so:

 

<?php
echo  'Hello World';
?>

 

Although you could enable short_tags in your php.ini file, I would advise you not to.  It's always best to use long tags, it's 3 extra characters that will save you a lot of grief in the long run.

Link to comment
Share on other sites

By default only .php files are parsed by php. Any .htm/.html files are not. To get .htm/.html files to be parsed by php, find the AddType line in your httpd.conf (or a .htaccess file) that contains the .php and add .htm and .html -

 

AddType application/x-httpd-php .php .html .htm

 

Stop and start your web server to get any changes made to httpd.conf to take effect (not necessary if making this change in a .htaccess file.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.