Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP 5.2.5 installation 1

Status
Not open for further replies.

FALCONSEYE

Programmer
Jul 30, 2004
1,158
US
Ok, I just started playing around with PHP. First, I installed Apache 2 (c:/program files/apache software foundation/apache2.2) and installed PHP 5.2.5. (c:/program files/php)

Now, I can hit ../htdocs/index.html which displays
It Works!

When I try to hit test.php, i see nothing. The test.php simply has

Code:
<html>...
<body>
<? print(Date("1 F d, Y")); ?>
</body>
</html>

Did i miss something? Does php and apache need to know of each other's existence?
If somebody can provide a link or tell me what i did wrong, i will appreciate.
thanks


 
You should probably use real php tags, not short ones. So open a PHP section with <?php and not just <? .

Furthermore, PHP5.0 gave a warning with all date and time functions, so putting a drop-dead sign (@) in front of it doesn't hurt. But your version probably has no trouble with it.
 
ok, I followed the instructions on the link provided by kherge. The following index.php throws a http 500 error.
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>

Only difference I have is :

LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
#(change the path to wherever the file is)
AddType application/x-httpd-php .php .phtml .inc .php3
AddType application/x-httpd-php-source .phps

the php5ts.dll file is under the Apache2.2/bin and the php.ini file is under Apache2.2/. Does anyone know why I still receive a http 500 error?
thanks

 
I had to do couple more tweaks and restart the server. Everything seems to be working fine. One star for kherge.
hey DonQuichote,
the php.ini file does have some instructions to process <? but I will stick with the best coding practices and use <?php instead.

 
short tags can be used but as you say, best practice dictates the long form. The practical reasons for maintaining best practice are two fold:

1. portability
2. potential confusion with the xml declaration
Code:
<?xml version="1.0" encoding="UTF-8"?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top