Forum Moderators: coopster

Message Too Old, No Replies

PHP4 on Redhat 8 - Anyone have this problem?

Message.

         

wannabePHP

4:27 am on Feb 8, 2003 (gmt 0)

10+ Year Member



Hi There,

I have a defualt installation of Redhat 8 with PHP4/Apache etc.

My PHP is working okay I guess, as when I put in the command to see if it is working, and access the webpage, it displays all of the PHP variables and etcetera.

However, I have tried about ten different PHP scripts, and end up with some of the code working, and the other code just displaying as text on the page.

Does anyone know of what this problem may be?

Cheers!

jamesa

5:04 am on Feb 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hmmm... make sure that all PHP code begin with <?php (or just <? with most installations) and ends with?>. Example:

<?php

// all your code here...

?>

wannabePHP

8:31 am on Feb 8, 2003 (gmt 0)

10+ Year Member



Thanks for the help. Yep all the codes begin with that.

Most of the scripts I have tried are that someone else has created. I am really not sure where to go to have tihs problem fixed! It seems that some of the code works, but other parts doesn't.

Cheers

Nick_W

8:35 am on Feb 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like the scripts not the installation. I have RH8 and there are no problems.

Nick

RussellC

3:45 pm on Feb 8, 2003 (gmt 0)

10+ Year Member



if your scripts are using mysql you need to install this rpm in Redhat 8.0 to get php and mysql working together properly: [rpmfind.net...]

David

5:26 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



Since my upgrade to Redhat 8.0, I have a one small script that don't work. It works on RH7.3 and 7.2.

The problem is posting form results to a script. If I change to a "get" it works. When using a post the variable is not parsed properly ie.

if I echo $variablename;
it returns.. variablename=stuff

If I use a "get" for the form
it returns... stuff

It seems to be either a bug with Apache 2.0 and php or a change in how variables are handled, or a config issue.?

This might be what you are having a problem with

Nick_W

5:29 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're PHP is probably now updated.
You'll need to use $_POST['varname'] to get your post vars I believe.

Nick

David

5:39 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



Are you saying convet the post variables to an array? I am not quite sure what you mean

Nick_W

5:45 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, I mean the new(ish) predefined Super Globals Arrays [php.net]

Nick

David

6:54 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



O.K. "Brain is moving slow today, well slower then normal"

register globals is on here is my test post form

<form action ="script.phtml" method="post">
<select name="test">
<option value="red">red</option>
<option value="blue">blue</option>
<option value="green">green</option>
</select>
<input type ="submit" value ="Go">
</form>

script.phtml ..
<?
echo $_POST['test'];
?>

the on screen results ..
redtest=red

I am confused, there are other scripts that use post data that work and I haven't been able to find the diiference.

Nick_W

7:03 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To be frank, I'm a little confused too ;) - I've experienced the same thing.

In all my programming I now use the super globals now though.

Nick

andreasfriedrich

7:23 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you verify that the server gets the right data?

jatar_k

7:30 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



since you have register globals on what does it do for

echo $test;

is it the same?

redtest=red

David

7:38 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



How would I do that?

echo $test;
It is the same

David

8:08 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



Just found this out on Google

For apache 2.X with php if you add

enctype="multipart/form-data" to the form tag it solves the problem.

Now, anyone no if I can make one change to the httpd.conf file to solve it?

David

8:28 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



It is a bug.

If you add another field to the form it works. It seems to only fail when there is just one field. Now I see why some forms worked and others failed.

jatar_k

8:43 pm on Feb 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



very strange, glad you fixed it.

maybe there is more info on it here
[bugs.php.net...]

David

9:01 pm on Feb 9, 2003 (gmt 0)

10+ Year Member



Actualy, I now feel pretty stupid :(

With apache 2.0 you include conf.d/*.conf. One of the configs is php.conf. The new way you addType is in the php.conf like this

<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
</Files>

<Files *.phtml>
SetOutputFilter PHP
SetInputFilter PHP
</Files>

I had had added the old way to the httpd.conf
AddType application/x-httpd-php .php .php4 .php3 .phtml .html

Once I removed that line all seems to be fine. :)