Click to See Complete Forum and Search --> : Geeting PHP 5 to work with Apache 2.2.4


Salazaar
06-05-2007, 08:49 PM
Hello,
I am currently working on a project to develop a web database application in PHP.
I have just installed Apache 2.2.4 and php_5.2.2 on my laptop that runs
Windows xp Home Edition. I used the msi installer for each and I edited
httpd.conf to use:

I tested php using a simple script, hello.php:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>

I saved it in htdocs as DocumentRoot is set to "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

In the php.ini file the short_open_tag = On

I run Apache tomcat and the browser address I use to run hello.php http://localhost:8080/hello.php

I also added the following lines to the Apache httpd.conf file

PHPIniDir "C:/Program Files/PHP"
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

The problem is the php page is blank so the configuration must be wrong but I don't know what
is wrong. Please help me.

:confused:
S

bradgrafelman
06-06-2007, 12:52 AM
When you say 'blank', is it actually blank? Meaning, did you view the source and see if any data was sent (a 'white screen' in a browser tells us very little about the data that the server returned).

Also, have you tried examining Apache's error logs?

EDIT: Lastly, I would suggest doing a manual installation and choosing a path that doesn't have spaces (e.g. c:\php\).

Salazaar
06-06-2007, 07:28 AM
Hi bradgrafelman,

Thanks for your reply. I just had a look at the source code as you suggested and its:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>

Also I had a look at Apache error log and nothing seems amiss there either(or at least I think not). Doesn't this line mean that everything should be working fine-

[Wed Jun o6 11:02:56 2007] [notice] Apache/2.2.4 (Win32) PHP/5.2.3 configured-- resuming normal operations



S.

sheephat
06-06-2007, 07:30 AM
<?php echo phpinfo(); ?>

sheephat
06-06-2007, 07:34 AM
WAIT no, <?php phpinfo(); ?> should not be returned in the sourcecode, there is an error in your php configuration.

If you are just starting with PHP and apache, Try a package, wampserver / xampp

Salazaar
06-06-2007, 09:12 AM
Thanks sheephat,

I have the phpinfo() displaying properly but now I have a problem with MySQL I get a 'Cannot connect to TCP 3306 port' I need to use PHP to connect to my local MySQL server installed on my laptop. How do I do this?


S.

sheephat
06-06-2007, 10:52 AM
Is mysql installed properly, if it is it may not be enabled. In WAMP there is an option, im not sure how this works for xaamp.

Are you connecting via localhost:3306 ?

Wampserver works straight out of the box, try the mysql documentation / php docs, most of the time your answers can be found there.

mpasternak
06-12-2007, 05:32 PM
probably the same thing i just had.

did you use the PHP5 installer? if so They goof up royally in the code.

Take a look at your HTTPD.INF file at the end for the auto generated code.

it automatically creates an entry for the lcation of PHP. but by default it appears like

"C:\\directory\\php\\adafd.dll"

which screws up. you need to remove the double "\\" and ensure there's only one

and if it is a windows machine, it needs to be \\ not / as I believe it still gets confused

bradgrafelman
06-12-2007, 06:11 PM
if it is a windows machine, it needs to be \\ not / as I believe it still gets confusedOn the contrary, I've always used forward slashes without a problem (avoids the backslash-is-an-escape-character issue, too) whether it be Windows, Unix, etc.