Board index   FAQ   Search  
Register  Login
Board index PHP PHP Installation

Can't get php going with Apache 1.3x

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

Can't get php going with Apache 1.3x

Postby brownie124 » Thu Feb 13, 2003 2:11 pm

Hi,

I am running Apache 1.3_14 under Windows 2K PE and have just installed PHP 4.3. I have a simple php file that basically just has a call to phpinfo() in it. This is place in the htdocs directory. When I try to view it in the browser (http://127.0.0.1/info.php), I receive an HTTP 400 error. I know the server installation itself is fine as I have been running it for years and other html files in the same directory display correctly. I must have something messed up in the configuration of PHP with the server because when I go to the php directory and run php -i I do get a dump of the expected html.

Here are the pertinent lines in my httpd.conf file:
ScriptAlias /php/ "C:/misc/PHP"
AddType application/x-httpd-php4 .php
Action application/x-httpd-php4 "/php/php.exe"

Any help would be greatly appreciated.

Thanks,
- Michael
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby Redcircle » Thu Feb 13, 2003 3:40 pm

does apache work with a regular html file?
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby brownie124 » Thu Feb 13, 2003 7:11 pm

Yes it does. I have been running it for years. I did some further investigating and there are many samples of httpd.conf files that contain the line:
LoadModule php_module "C:/misc/PHP/sapi/php4apache.dll"

When I do that, I cannot initialize the server. Does anyone know why?
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby brownie124 » Thu Feb 13, 2003 7:20 pm

Oh, by the way, the error that I am getting is:
Could not start the Apache Service on Local Computer
Error 1067: The process terminated unexpectedly.

As soon as I remove the LoadModule php_module... line, it starts just fine.

Thanks,
- Michael
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby Redcircle » Fri Feb 14, 2003 12:42 am

what is the complete version of apache. it may not support the module.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby Oleg Butuzov » Fri Feb 14, 2003 6:19 am

brownie124 wrote:When I do that, I cannot initialize the server. Does anyone know why?


error in the httpd.conf
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby brownie124 » Fri Feb 14, 2003 6:41 am

The version I am using is 1.3.27.
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby brownie124 » Fri Feb 14, 2003 8:26 am

Well, I have made some progress. I can now get the module loaded. I had to change LoadModule php_module to LoadModule php4_module. However, I am having another problem. Again, going back to an attempt to execute a simple php file in my htdocs directory, the browser wants to download the file instead of executing php.

There is still something wrong, but I am not sure if it is in the php.ini file, the httpd.conf file or what.

Any help would be appreciated.

Thanks,
- Michael
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby brownie124 » Fri Feb 14, 2003 8:47 am

I finally have it.

Thanks.
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby WiZARD » Sat Feb 15, 2003 2:41 am

Cause Windows (by Billy Gates) is very big suxx in some situation need reinstall apache, if you what to run it.... :?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby vanciva » Wed Feb 19, 2003 3:36 pm

Hi, Dear brownie124:

I had same problem with my Apache on W2K. When trying to execute a simple php file, the "save as ..." window pop up, after I added these lines in httpd.conf

LoadModule php4_module e:/php/sapi/php4apache.dll
AddModule mod_php4.c
Action application/x-httpd-php4 e:/php/php.exe
AddType application/x-httpd-php4 .php3 .php

it will not ask me to save ... instead, the file simply not diplayed (The page cannot be found ... HTTP 400 - Bad Request Internet Explorer).

you have solved the problem, and can get your help?

Thanks!
vanciva
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Feb 19, 2003 3:25 pm

Postby brownie124 » Wed Feb 19, 2003 6:18 pm

Vanciva,

You do not need the "Action Application..." line as you are loading php as a module and NOT a cgi executable.

Also, instead of application/x-httpd-php4, make it application/x-httpd-php (without the 4).

Hope that helps

- Brownie
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby vanciva » Mon Feb 24, 2003 10:02 pm

Hi, Brownie:

thanks for your reply. I followed you and did some change to httpd.conf (this is the line I have now: AddType application/x-httpd-php .php4 .php3 .phtml). Now .php pages can be displayed, but the browser seems ignoring the php code embeded in the html. when looking at the page source, I can see all the php codes and they are not being executed. too see what i am talking about, herer is a simple example:

page source before inputing info in the html form:
address bar: http://localhost:81/phpapp/sign.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>

<!--
//<?php
//print("Hello Web!");
//?>
-->

<style type="text/css">
<!--
h3 {font-family: arial, helvetica, sans-serif; color: 000099;}
txt {font-family: arial, helvetica, sans-serif; color: 003399;}
-->
</style>

<title>Sing My Guestbook Page</title>
</head>
<body>

<table width=600 align=left valign=top>
<tr>
<td colspan=2>
<h3>Sign My Guestbook: </h3>
<hr 100% color=green>
</td>
<tr>
</tr>
<form action="sign.php" method="GET">
<!--
//$PHP_SELF must use uppercase
-->
<tr>
<td align=right>
<p>Name:
</td>
<td align=left>&
<input type="text" name="name" size="50" value="">
<td align=right>
</tr>
<tr>
<td align=right>
<p>Location:
</td>
<td align=left>&
<input type="text" name="location" size="50" value="">
</td>
</tr>
<tr>
<td align=right>
<p>Email:
</td>
<td align=left>&
<input type="text" name="email" size="50" value="">
</td>
</tr>
<tr>
<td align=right>
<p>URL:
</td>
<td align=left>&
<input type="text" name="url" size="50" value="">
</td>
</tr>
<tr>
<td align=right valign=top>
<p>Comments:
</td>
<td align=left valign=top>
<textarea rows="4" cols="50"></textarea>
</td>
</tr>
<tr>
<td align=right valign=top>
<p><input name="sign" value="Sign" type="submit">
</td>
<td align=left valign=top>
<input name="startover" value="Start Over" type="reset">
</td>
</tr>
</form>
</table>

<?php

if (isset($name))
{
echo "$name<br> $location<br>";
}
?>

</body>

after:
address bar: http://localhost:81/phpapp/sign.php?nam ... &sign=Sign
page source code is exactly same as before clicking "submit" button.

Thanks!
vanciva
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Feb 19, 2003 3:25 pm

Postby brownie124 » Thu Feb 27, 2003 5:05 am

Hi Vanciva,

There are a couple of things that you need to do:
First of all, I would turn error logging on so you can see what is happening. In your php.ini file look for the line that sets the error_log variable and set it to something like this:
error_log = "C:\PHP\errors\error.log". So, in the future, you can look there and it may help you determine what is going on.

If you are going to use multiple php pages and want to be able to access and modify variables from other pages there are additional things that you have to do. This is nice because you don't have to pass anything in the url. In other words, you could change your "method=get" to "method=post".

To do this you have to enable sessions in your php installation. This requires that you modify the line in your php.ini that sets the session.save_path variable. You want to set it to something like:
session.save_path = c:/temp

You now will have to change your php code slightly. You need to add session_start(); in both your php files (its good practice to make it the first line of your php code.) In your first php file (the one with the form) you need to register the variables that you want to share across php files. You do this with session_register("foo_var"). Then to access a session variable you would do it like this:
$_SESSION['foo_var']="Hello World!";

In your second php file (in your case sign.php) you would then do something like this:
echo $_SESSION['foo_var'];

And you should be set. Remember, the session_start() must be in all your php files where you want to share variables.

Also, you can go to where you set up the session variable files (c:\temp) and look at the values.

Hope this helps.

- Brownie
brownie124
New php-forum User
New php-forum User
 
Posts: 23
Joined: Thu Feb 13, 2003 1:58 pm
Location: Peterborough, NH

Postby WiZARD » Thu Feb 27, 2003 8:08 am

Hi vanciva!
interestin for what is this:

http://localhost:81/phpapp/sign.php
i mean :81?

problem what php not running :(

See in httpd.conf
where you have a mistake....
In a future if you some change in in this file need restert apache....
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP Installation

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron