PDA

View Full Version : Apache Webserver,PHP ---> PROBLEM



ForrestFunk
10-21-2002, 09:36 PM
Hi

i want to run an apache webserver with php4 and mysql on my local pc. it worked some windows

installations before...but now i dont get it working!the apache is no problem...and mysql

should also be no problem(havent tried it already)but i dont get php working...

ive got apache 2.0.43,php 4.2.3

i want to run it on win xp pro( yes i know linux would be better)

i found several tutorials...but the content is always the same:
---------------------------------------------------------------
add these lines to ur httpconf

ScriptAlias /php4/ "C:/{ur php-dir}/"
Action application/x-httpd-php4 "/php4/php.exe"
AddType application/x-httpd-php4 .php
---------------------------------------------------------------

i added them...but i didnt work

so is here a prof who could help me ( Salvation perhaps)

the above code is for the cgi-version...i would prefer to run the module-version

i know that this isnt everything i have to do...but i think in these lines are "my" errors

if anyone has links to good tutorialsites???

i hope its not to confused how i wrote it down

thnx :shock:

MadHatter
10-21-2002, 11:55 PM
ok, so what is happening?

what happens when you try to run a php script on your webserver. does it spit out a text version of the code? does it give you an error? does it just not show you anything?

Grimmy
10-22-2002, 04:26 AM
buy, got me there, I am not in to that stuff, I just like to have my servers that I use have those features available lol

Bones
10-22-2002, 07:10 AM
See if this works:

1. get the latest build: http://snaps.php.net/win32/

2. instead of using scriptalias, add these to httpd.conf:
[code:1:2ccee814fe]
LoadModule php4_module c:/[your php dir]/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
[/code:1:2ccee814fe]

3. did you follow directions for php installation? php.ini and php4ts.dll should be in your system32 dir.

ForrestFunk
10-22-2002, 09:49 AM
[quote:e122ba5d66="MadHatter"]ok, so what is happening?

what happens when you try to run a php script on your webserver. does it spit out a text version of the code? does it give you an error? does it just not show you anything?[/quote:e122ba5d66]

this is the code of my testsite: info.php
---------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>test</title>
</head>

<body>
before
<?php phpinfo()?>
after


</body>
</html>
--------------------------------------

output: before after...it ignores the php-code i think :(

any suggestions?

ForrestFunk
10-22-2002, 09:55 AM
[quote:a7538f71c0="Bones"]See if this works:

1. get the latest build: http://snaps.php.net/win32/

2. instead of using scriptalias, add these to httpd.conf:
[code:1:a7538f71c0]
LoadModule php4_module c&#58;/&#91;your php dir&#93;/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
[/code:1:a7538f71c0]

3. did you follow directions for php installation? php.ini and php4ts.dll should be in your system32 dir.[/quote:a7538f71c0]

i tried this version too...but i dont know where exactly i have to add this lines...and i think u cant type them simply at the and of the conf-file...or can i do that?

the .dll is in my system32 dir...but i thought the ini should be directly in the windows-dir?

i will try this and let ya know what happends
hope i get it working soon :mad:

ForrestFunk
10-22-2002, 04:29 PM
i think apache finds the php-module(arrow on pic :D ) but it still doesnt parse the files.... :(

i change alot of things..sometimes it shows at least the html code("before" and "after" from the above post) and sometimes it tells me there isnt a info.php...BUT I KNOW ITS THERE :twisted: :shock:

damn

MadHatter
10-22-2002, 07:16 PM
did you add that stuff to your httpd.conf file in the apache dir? if you open httpd.conf in notpad and scroll down some there will be a big list of things like:


AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4

but for cgi and html and shtml files... that is where you add everything else.

it sounds like apache is just not parsing the php file. so you dont end up with any output. if you have changed a lot of stuff you might want to think about starting from scratch with apache and php4. and follow the installation guide that http://www.php.net gives you. iirc there is now an exe that will install php on an apache server preaty much automaticly.

ForrestFunk
10-23-2002, 10:34 AM
[quote:d31b7b87a7="MadHatter"]did you add that stuff to your httpd.conf file in the apache dir? if you open httpd.conf in notpad and scroll down some there will be a big list of things like:


AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4

but for cgi and html and shtml files... that is where you add everything else.

it sounds like apache is just not parsing the php file. so you dont end up with any output. if you have changed a lot of stuff you might want to think about starting from scratch with apache and php4. and follow the installation guide that http://www.php.net gives you. iirc there is now an exe that will install php on an apache server preaty much automaticly.[/quote:d31b7b87a7]

i ll check this out this evening...thanx to everybody

ForrestFunk
10-23-2002, 10:45 AM
just found something in the error.log:

[Wed Oct 23 11:40:57 2002] [notice] Child 2044: Child process is running
[Wed Oct 23 11:40:58 2002] [notice] Child 2044: Acquired the start mutex.
[Wed Oct 23 11:40:58 2002] [notice] Child 2044: Starting 250 worker threads.
[Wed Oct 23 12:43:11 2002] [error] [client 127.0.0.1] Premature end of script headers: php.exe

anybody knows what it means?

MadHatter
10-23-2002, 02:02 PM
that can mean a lot of things..

Try setting "log_errors=On" in your php.ini (it's Off by default)...
this won't solve the problem, but hopefully you'll get some meaningful
error message in your error_log that will help you track the problem.

Mr Clean
10-23-2002, 06:45 PM
SPAM

ForrestFunk
10-23-2002, 10:27 PM
[quote:9d92d7806e="Mr Clean"]SPAM[/quote:9d92d7806e]

yeahaaa...thanx Mr Clean...now it works :wink:

no really...got it working :shock: only for those who might be interested,the following text helped me...
[quote:9d92d7806e]The Apache server 2.0.39 http://www.apache.org/dist/httpd/binaries/win32/

Latest stable PHP http://snaps.php.net/win32 (check the log file http://snaps.php.net/win32/snapshot-STABLE.log and find the line that says 'Building php4apache2'. If there's an OK next to it then you can download that version from the parent directory http://snaps.php.net/win32 )

Install Apache server

Unzip the php4-win32-STABLE-snapshotnumber.zip, you'll get a folder php4-win32-STABLE-snapshotnumber

Rename it to PHP and copy it to the root drive (usually c:, so you end up with c:PHP)

Copy the php.ini.recommended file to c:winnt (or c:windows) and rename it php.ini

edit php.ini in notepad as follows:
1. find 'doc_root' using ctrl+F and set doc_root = "C:Program FilesApache GroupApache2htdocs" (assuming you installed Apache in its default path)
2. find 'extension_dir' using ctrl+F and set extension_dir = "C:PHPsapi"
3. save it and exit

Move the file php4ts.dll from C:PHP to c:winntsystem32 (or c:windowssystem)

[size=14:9d92d7806e][color=red:9d92d7806e]Go to the folder C:PHPsapi and rename php4apache2.dll to php4apache2.so (basically just change the extension from .dll to .so)[/color:9d92d7806e][/size:9d92d7806e]

Go to Start -> Programs -> Apache HTTP Server 2.0.39 -> Configure Apache Server and click on 'Edit the Apache httpd.conf Configuration File'

[size=14:9d92d7806e][color=red:9d92d7806e]the httpd.conf file opens up. Look for the block of LoadModule statements and at the end of the block add
LoadModule php4_module c:/php/sapi/php4apache2.so[/color:9d92d7806e][/size:9d92d7806e]

[size=14:9d92d7806e][color=red:9d92d7806e]then look for AddType using ctrl+F and below AddType application/x-tar .tgz add
AddType application/x-httpd-php .php[/color:9d92d7806e][/size:9d92d7806e]

Save and exit.

Stop Apache and start again and you should be good to go.
[/quote:9d92d7806e]

Twin])I2agon
10-23-2002, 11:34 PM
[quote:2782381087="ForrestFunk"]Move the file php4ts.dll from C:PHP to c:winntsystem32 (or c:windowssystem)

Go to the folder C:PHPsapi and rename php4apache2.dll to php4apache2.so (basically just change the extension from .dll to .so)

Go to Start -> Programs -> Apache HTTP Server 2.0.39 -> Configure Apache Server and click on 'Edit the Apache httpd.conf Configuration File'

the httpd.conf file opens up. Look for the block of LoadModule statements and at the end of the block add
LoadModule php4_module c:/php/sapi/php4apache2.so

then look for AddType using ctrl+F and below AddType application/x-tar .tgz add
AddType application/x-httpd-php .php

Save and exit.
[/quote:2782381087]


Man thats exactly what i told u on the phone last day....u never listen to what i say :lol:

ForrestFunk
10-24-2002, 04:42 AM
[quote:510bedd375="Twin])I2agon"][quote:510bedd375="ForrestFunk"]Move the file php4ts.dll from C:PHP to c:winntsystem32 (or c:windowssystem)

Go to the folder C:PHPsapi and rename php4apache2.dll to php4apache2.so (basically just change the extension from .dll to .so)

Go to Start -> Programs -> Apache HTTP Server 2.0.39 -> Configure Apache Server and click on 'Edit the Apache httpd.conf Configuration File'

the httpd.conf file opens up. Look for the block of LoadModule statements and at the end of the block add
LoadModule php4_module c:/php/sapi/php4apache2.so

then look for AddType using ctrl+F and below AddType application/x-tar .tgz add
AddType application/x-httpd-php .php

Save and exit.
[/quote:510bedd375]


Man thats exactly what i told u on the phone last day....u never listen to what i say :lol:[/quote:510bedd375]

lol...u told me NOTHING :mrgreen: ...but u should go to bed earlier :wink:

btw, i ll have a look for ur new 19" monitor and tell u if its really such a sharp picture :shock: 8)