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
https://forums.phpfreaks.com/topic/92359-php-isnt-behaving/
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
https://forums.phpfreaks.com/topic/92359-php-isnt-behaving/#findComment-473526
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
https://forums.phpfreaks.com/topic/92359-php-isnt-behaving/#findComment-473590
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.