Forum Moderators: coopster

Message Too Old, No Replies

Get "Hello World" Blank Page After PHP Install on Windows

PHP with Apache Server

         

RobinR

2:50 am on Jan 2, 2009 (gmt 0)

10+ Year Member



I have Windows 2000 Professional on my laptop and installed the apache server to:

C:\Program Files\Apache Group\Apache

In the httpd.conf file I changed Port 8080 to Port 8060

Therefore, these lines:

Listen 8060
Servername localhost:8060

The comment from the line above has been removed.

For PHP 5 CGI added:
ScriptAlias /php/ “c:/php/”
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php-cgi.exe”
SetEnv PHPRC C:/php

I restarted the computer and then started the Apache server manually.
The error.log looks fine: Starting thread to listen on port 8060
***********
I then manually installed php on my laptop

c:\php

Using the Control Panel
System Icon > Environment Variables > System Variables

I edited the path name and added to the end:

;c:\php;c:\php\ext;

and restarted computer

I then renamed the php.ini-recommended file to php.ini and made the following changes:
browscap = “c:\winnt\system32\inetserv\browscap.ini”

cgi.force_redirect = 0

doc_root=”c:\Program Files\Apache Group\Apache\htdocs”
mysql.default_socket = MySql
mysql.default_host = localhost
extension_dir = “c:\php\ext”

Removed comment from beginning of
extension=php_mysql.dll

I then created hello.php and put in web server’s root directory:
C:\Program Files\Apache Group\Apache\htdocs

Code:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
</php echo ‘<p>Hello World</p>’;?>
</body>
</html>
******************************
In Internet Explorer address window

[localhost:8060...]

I should see the words “Hello World” but I get a blank page.

What do I need to change or add to get PHP to work with the Apache Server?

Robin

vincevincevince

3:11 am on Jan 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First;
you must restart the apache server to load PHP
Second;
dip into your apache error_log file - check for start-up errors (probably something related to a path to php) - and errors which result when you visit hello.php

RobinR

1:27 pm on Jan 2, 2009 (gmt 0)

10+ Year Member



I restarted the Apache server. This is all I found in the error log today. I don't see anything about PHP even though I did try to view hello.php in Internet Exporer:

[Fri Jan 02 08:10:20 2009] [notice] Apache/2.2.11 (Win32) configured -- resuming normal operations
[Fri Jan 02 08:10:20 2009] [notice] Server built: Dec 10 2008 00:10:06
[Fri Jan 02 08:10:20 2009] [notice] Parent: Created child process 1372
[Fri Jan 02 08:10:20 2009] [notice] Child 1372: Child process is running
[Fri Jan 02 08:10:20 2009] [notice] Child 1372: Acquired the start mutex.
[Fri Jan 02 08:10:20 2009] [notice] Child 1372: Starting 64 worker threads.
[Fri Jan 02 08:10:20 2009] [notice] Child 1372: Starting thread to listen on port 8060.

Robin

RobinR

9:39 pm on Jan 2, 2009 (gmt 0)

10+ Year Member



There are two different methods of installing the Apache server:
as a CGI binary
as an Apache module

I decided to try the module and made the necessary changes in httpd.conf to get Apache 2.2 working with PHP 5. However, I then got this error message:

“Cannot load C:\php\php5apache2.dll into server. The specified module could not be found.”

I searched for these words on the internet and found out that Apache 2.2 didn’t work with PHP 5. The writer said he was going back to Apache 2.0. I decided to do the same and PHP now works. (I'm using the CGI method) Hello.php displays “Hello World”.

Take a look at:
[phpbuilder.com...]

Robin

coopster

9:34 pm on Jan 4, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I searched for these words on the internet and found out that Apache 2.2 didn’t work with PHP 5.

Incorrect. PHP5 works quite well with Apache 2.2 on Windows. The error in your ways here is you are attempting to load the wrong module version in your Apache configuration. When running on 2.2 you need to use the PHP 2.2 Apache module in your conf ...

LoadModule php5_module "c:/php/php5apache2_2.dll"

More info here ...

[php.net...]

Note: Apache 2.2.x Support
Users of Apache 2.2.x may use the documentation below except the appropriate DLL file is named php5apache2_2.dll and it only exists as of PHP 5.2.0. See also » [snaps.php.net...]