PDA

View Full Version : PHP doesnt seem to work on my Direct Admin server??


phpMyHosting
07-27-2003, 09:04 AM
i have a page at
http://www.phpmyhosting.com/support/test.php
with the code


CODE

<form method="POST" action="test.php">
<input type="text" name="text">
<input type="submit" name="submit">
</form>
<? echo($text);?>




And for some reason the page does not display what you send in the textbox. Any ideas?
Also my includes are not working..


CODE

<?
include ($DOCUMENT_ROOT . "/header.php");
?>




the form and the includes work on all the other servers i have tried except for the Direct Admin one.
Any ideas?

Mike

loopforever
07-27-2003, 10:57 AM
Probably a register_globals issue. Replace:

<? echo($text);?>

with

<? echo($HTTP_POST_VARS["text"]);?>

And try it.

phpMyHosting
07-27-2003, 11:02 AM
ah, that worked, how do i go about fixing it then? i dont want to change all my files from <? echo($text);?> to <? echo($HTTP_POST_VARS["text"]);?>!!

Mike

loopforever
07-27-2003, 11:03 AM
Turn the register_globals variable on in your php.ini. This, however, is not suggested. Any script written to use register_globals is poorly written, because it:

1) Is at greater risk of being hacked.
2) Decrease script performance.

But, if you must have register_globals, it can be turned on in the php.ini file.

phpMyHosting
07-27-2003, 11:07 AM
but all the other servers i have used.. cpanel, ensim and plesk all work with the first script

loopforever
07-27-2003, 11:13 AM
That is because they had register_globals enabled. The PHP developers do not recommend using it, however the feature is still available to those who need it.

phpMyHosting
07-27-2003, 11:25 AM
oh right, but if the larger CPs use it then it must be ok to have it enabled yea? If it was a security risk they wouldnt do it otherwise no one would use their CP as it would be unstable

loopforever
07-27-2003, 11:30 AM
It is overall a bad programming practice to use register_globals, all of the control panel developers know this. They keep it enabled because they are well aware that there are a signficant number of people who do not understand the downsides to it.

Simply put: lazy or inexperienced programmers utilize register_globals (on) because they do not know enough to do otherwise. Unfortunately, a vast majority of "PHP scripters/programmers" are lazy or inexperienced, and for this reason, register_globals is defaulted on by all other control panels.

l0rdphi1
07-27-2003, 12:28 PM
I can't agree more with loopforever :)

Mahmoud
07-28-2003, 02:27 PM
loopforever is correct, It's Insecure and that's why php recommends to have it disabled/off.


If you want to turn on Register Globals go to a phpinfo.php page on your server or create it yourself:

<?php phpinfo(); ?>

It will tell you where is the php.ini
then in the shell :
pico /path/to/php.ini

and search for register globals and turn them on.

Then restart apache : service httpd restart

I did not get my hands on a server with Direct Admin installed on so I do not know where they have their php.ini stored.

it should usually be either:
/etc/php.ini
or
/usr/local/lib/php.ini