PHP with Apache..i need a very little help.

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

PHP with Apache..i need a very little help.

Post by crazytopu »

Hi,

After installaion i tried to test if my PHP is up and running with Apache 1.3.29.

So, i copied the following simple PHP code into a file that i named as hello.php and put this file inside default web root directory for apache

C:\Program Files\Apache Group\Apache\htdocs

Here is the code:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo "<p>Hello World</p>"; ?>
</body>
</html>


and the tutorial [www.php.net ] where i got this code says i should get the following output if i go to my browser and type

http://localhost/hello.php

following output will make it to your browser:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>


But i see nothing. yes i see nothing but a blank white page. I am sure it gets executed but why don't i get the output? i checked the view and source and i got the source code there.

I added the following 3 lines in my httpb.ini file:

AddModule mod_php4.c

LoadModule php4_module "c:/php/sapi/php4apache.dll"


AddType application/x-httpd-php .php


I added these line to make my php work as a module so that when my apache starts my php also gets up and running. You think i did any wrong in configuring httpb.ini file?

Do i have to add any additional line apart from these 3?

When i type http://localhost

I see that my apace is working. So, what's wrong then with my php?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

php has been istalled really to c:/php and the necessary dlls can be found (i.e. no errors occur when starting the apache process)?
You did restart apache before requesting hello.php (changes in the configuration file take place after a restart only)?
If you open the browser's source view is the source code displayed there (meaning php does not handle the script)?
is there anything related to your http-request in C:\Program Files\Apache Group\Apache\logs\error.log?
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

Post by crazytopu »

As the installer guide in http://www.php.net says:

"There are two main ways to install PHP for Windows: either manually or by using the InstallShield installer."

I tried the easy one first which is InstallShield installer everything went alright until i had to configure the httpb.ini file where i saw that the 3 lines that i have to insert does not get the path right coz there are no such folders installed actually in my c:\php. If you know you can help me out with this too. My question is if i use InstallShield installer do i get the exactly same tree structure as follows:

c:\php
|
+--cli
| |
| |-php.exe -- CLI executable - ONLY for commandline scripting
|
|
+--dlls -- support dlls for extensions --> Windows system directory
| |
| |-expat.dll
| |
| |-fdftk.dll
| |
| |-...
|
+--extensions -- extension dlls for PHP
| |
| |-php_bz2.dll
| |
| |-php_cpdf.dll
| |
| |-..
|
+--mibs -- support files for SNMP
|
|
+--openssl -- support files for Openssl
|
|
+--pdf-related -- support files for PDF
|
|
+--sapi -- SAPI dlls
| |
| |-php4apache.dll
| |
| |-php4apache2.dll
| |
| |-php4isapi.dll
| |
| |-..
|
|-install.txt
|
|-..
|
|-php.exe -- CGI executable
|
|-..
|
|-php.ini-dist
|
|-php.ini-recommended
|
|-php4ts.dll -- main dll --> Windows system directory
|
|-...


I did not get this tree structure when i tried the InstallShield installer. So then I tried the other option - manually.

But this time as you know i did not have to install it. I download the windows zip binary and extracted it in c:\php. I checked the tree structure of the folder and got all the .dll files there. I then copied the php4ts.dll in my winnt\system32.

I did not make any change in the php.ini file nor did i copy any of the two .ini files to anywhere [though in some installation the suggested that i better copy it one of these ini file to winnt and rename it as php.ini].

I resarted apache several time after i made change to my configuration file. And i think php could not handle the script and that's why it did not display anything.

this is what my log file displayed:

[Mon Nov 10 00:43:14 2003] [error] [client 127.0.0.1] File does not exist: c:/program files/apache group/apache/htdocs/iishelp/
[Mon Nov 10 00:43:18 2003] [error] [client 127.0.0.1] File does not exist: c:/program files/apache group/apache/htdocs/localstart.asp
[Mon Nov 10 02:27:49 2003] [error] [client 127.0.0.1] File does not exist: c:/program files/apache group/apache/htdocs/iishelp/
[Mon Nov 10 02:28:42 2003] [error] [client 127.0.0.1] File does not exist: c:/program files/apache group/apache/htdocs/iishelp/


Let me know if you need more information.

Thank you so much
Post Reply