Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-22-2003, 10:16 AM   #1
LQ Newbie
Registered: Jul 2003
Location: Victoria
Distribution: redhat 9
Posts: 9

Rep: Reputation: 0
Question PHP not working properly with redhat 9


I'm another total newbie...

I've just installed Redhat 9 and have installed php. When I type:
rpm -qa | grep php

I get:


I have started and stopped httpd

I can view our simple php page just fine, but when I try to run it, nothing happens except that it says "connecting to..." for a moment and then disappears. It runs fine on another linux server with php. It does not actually connect to a database.

An example of the script is at: (the script works fine in this location).

any ideas?

Old 07-22-2003, 12:38 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
You said it is connecting to a database - is the database backend up?
Old 07-22-2003, 12:59 PM   #3
LQ Newbie
Registered: Jul 2003
Location: Victoria
Distribution: redhat 9
Posts: 9

Original Poster
Rep: Reputation: 0
this particular php script page does not actually connect to a database. Everything is self-contained within the html page, so it shouldn't actually be trying to connect to anything,

I assume that if php is installed properly, it should work?

here is the script:<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

Ask the magic 8-ball a question!
<form method="post" action='<? echo $PHP_SELF; ?>'>
<input type="text" name="question" value="<? echo $question; ?>">
<input type="submit" value="Tell me, o wise one"></form><br>

if (isset($question)) {
$answers = array( "Yes",
"Of Course",
"Theres a Chance",
"What do you think I am, psychic?",
"If you're lucky");
srand((double) microtime() * 1000000);
$count = count($answers);
echo "The wise 8-ball says... " . $answers[rand(0,$count)];

Old 07-23-2003, 11:11 AM   #4
LQ Newbie
Registered: Jul 2003
Location: Victoria
Distribution: redhat 9
Posts: 9

Original Poster
Rep: Reputation: 0
I have the answer.. in case anybody out there has a similar problem. It wasn't related to the linux install at all - here is the answer I received:

This script was apparently written for an older version of PHP or a 4.2 or later version that had register_globals enabled in php.ini. The default in 4.2 an later has register_globals off as a security measure and that means that request variables from forms are passwd in an associative array. So in your code you test to see if $question is set to indicate that the page has been called from the form and that variable will never be defined as you haven't extracted it from the $_POST associative array. I'm not where I have an Apache/PHP to test with at the moment but if you change:

if (isset($question)) {

to read:

if (isset($_POST['question'])) {

I think it will work on RH 9. You can read more about this behaviour of PHP at


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
opengl is not working properly PinRojas Debian 7 07-05-2005 12:19 PM
Samba Not Working Properly linux-rulz Linux - Networking 4 04-14-2005 03:15 AM
Apache httpd not loading php pages properly. queezythegreat Linux - Networking 0 09-26-2004 03:50 PM
X not working properly. MylesCLin Linux - Software 1 09-15-2004 10:46 AM
apache or php doesn't work properly on RH8.0 abd_bela Linux - Networking 6 03-18-2003 05:20 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration