PHP wierd problem...

Posted:
in Genius Bar edited January 2014
Hi Can anyone help me out with a wierd PHP problem?



On my PB G4 I'm running:



Default install of Apache 1.3 on port 80 (it's actually turned off normally except for testing).



Apache 2 Install from server logistics, setup with PHP, Perl, MySQL etc.. on port 100



Now the problem is this: I have php scripts in pages that run fine in both web servers, they include the test phpinfo command, include and require commands that auto insert the headers etc...

HOWEVER, I have one script that just won't run in the apache 2, only in the 1.3 install, it is a form that can upload/delete/rename files in a folder. It just won't work in v.2 install, the Submit button, doesn't produce any result.

Any ideas? surely php either works or it doesn't...



Edit: I can post code if you need it to debug, but I've gone through and they are identical in each install, both PHP4 compliant. I was thinking it might be an httpd.conf thing but I can't find anything thats relevant.



[ 10-21-2002: Message edited by: robster ]</p>

Comments

  • Reply 1 of 7
    torifiletorifile Posts: 4,024member
    It sounds like there may be a problem with your apache 2 configuration. There may not be a valid upload directory or something. In the phpinfo, there should be a place where it lists those variables. What does it say for the apache2 setup? I'm thinking specifically of the upload_tmp_directory. Maybe I'm wrong (I've never actually tried to make an upload script)
  • Reply 2 of 7
    [quote]Originally posted by torifile:

    <strong>It sounds like there may be a problem with your apache 2 configuration. There may not be a valid upload directory or something. In the phpinfo, there should be a place where it lists those variables. What does it say for the apache2 setup? I'm thinking specifically of the upload_tmp_directory. Maybe I'm wrong (I've never actually tried to make an upload script)</strong><hr></blockquote>



    hey maybe you're right- the upload-tmp-directory field has 'no value' in both the local and master field...any idea how I fix it?
  • Reply 3 of 7
    torifiletorifile Posts: 4,024member
    Sorry for not getting back to you sooner. I'm not sure of this, but try editing the php.ini file. For some strange reason, I can't seem to find mine. :confused: but I'm sure it's got to be set there.
  • Reply 4 of 7
    robsterrobster Posts: 256member
    [quote]Originally posted by torifile:

    <strong>Sorry for not getting back to you sooner. I'm not sure of this, but try editing the php.ini file. For some strange reason, I can't seem to find mine. :confused: but I'm sure it's got to be set there.</strong><hr></blockquote>



    yeah that fixed it! register_globals is set to off by default now so my code wouldn't work till i re enabled it.Sorted!
  • Reply 5 of 7
    I would recommend at some point going back through your code and rewriting it to accommodate global variables being off. The default setting has been changed because global vars are a security risk.



    Also at some point you have to figure most hosts are going to upgrade to newer versions of PHP which have global vars off - keeping your code written to accommodate global vars means it has a shorter life span...



    But then again, who has time to go back through old code and rewrite it? <img src="graemlins/oyvey.gif" border="0" alt="[No]" />
  • Reply 6 of 7
    [quote]Originally posted by The Pie Man:

    <strong>.But then again, who has time to go back through old code and rewrite it? <img src="graemlins/oyvey.gif" border="0" alt="[No]" /> </strong><hr></blockquote>



    Well I have the time but I can't figure it out...duh!....I'm probably missing something blindingly obvious...anyone care to advise?
  • Reply 7 of 7
    With global vars on (or pre-PHP 4.2):



    A variable can be coming from anyplace and be used by referring to that var without any indication of where it is coming from. In other words, it doesn't matter if you are referencing a POST var, a GET var, a session var, a server var, etc...



    So for instance if you have $var that comes from a form using POST, you can just use $var in your code without referencing where it is coming from (it is a global variable). With global vars off, you need to declare that this is a variable coming from a POST - so you need to reference $_POST['var']; (or $HTTP_POST_VARS['var'] but this is deprecated and longer to type.)



    Same thing with vars in URLs (GET vars). You would reference $_GET['var'] instead of $var.



    Check out this page - it gives the lowdown on predefined variables and the changes to global vars and how to use them:



    <a href="http://www.php.net/manual/en/language.variables.predefined.php"; target="_blank">http://www.php.net/manual/en/language.variables.predefined.php</a>;
Sign In or Register to comment.