PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 7th, 2002, 12:54 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
None of my scripts work all of a sudden!

I have just upgraded my Win2K server from IIS5 to Apache 2, and now my scripts don't work correctly. The pages display ok, but when I click submit, the forms just reload rather than sending the email like it should and then displaying the confirmation page.

Any ideas?

Reply With Quote
  #2  
Old October 7th, 2002, 12:58 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: None of my scripts work all of a sudden!

Did you also upgrade PHP? Sounds like a classic case of register_globals being off. Check that setting in your php.ini

Reply With Quote
  #3  
Old October 7th, 2002, 01:01 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: None of my scripts work all of a sudden!

No it's on...

register_globals = On

Reply With Quote
  #4  
Old October 7th, 2002, 01:05 PM
Matt Matt is offline
Contributing User
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: None of my scripts work all of a sudden!

Can you give an example of something that doesn't work? No need to post a big long script..just a simple example that doesn't work...

Reply With Quote
  #5  
Old October 7th, 2002, 01:19 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: None of my scripts work all of a sudden!

php Code:
Original - php Code
  1.  
  2. <form name="test" method="post" action="<?php echo $PHP_SELF ?>"

The above just reloads the form without processing it.

Also, I am using
php Code:
Original - php Code
  1. require('common.php');
but have just realised that none of the variables set in that file are being display. For example, I have
php Code:
Original - php Code
  1. author="Mike Howard";
, but in my HTML code that is not being displayed, it's just blank.

Before I upgraded to Apache, all this worked, I have not changed any of my scripts.

Reply With Quote
  #6  
Old October 7th, 2002, 01:57 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: None of my scripts work all of a sudden!

Can you give an example of what it not working? An actual script? None of the examples your gave will do anything on their own.

Reply With Quote
  #7  
Old October 7th, 2002, 02:12 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: None of my scripts work all of a sudden!

I can post the whole script, but it is fairly big, does this help?

php Code:
Original - php Code
  1.  
  2. $auth_name = "Mike Howard"
  3. $auth_email = "mhoward@travelbag.co.uk";
  4. $auth_phone = "01420 546371";
  5. $auth_ext = "2371";
  6.  
  7. function page_header()
  8. {
  9. ?>
  10. <!-- Page written by <?php echo $auth_name ?> (<?php echo "$auth_email / Ext No. $auth_ext / DDI No. $auth_phone" ?>) -->

The HTML comment just comes out as
<!-- Page written by ( / Ext No. / DDI No. ) -->

does this help?

Reply With Quote
  #8  
Old October 7th, 2002, 02:27 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: None of my scripts work all of a sudden!

I couldn't tell you why it used to work, but I can tell you why it doesn't work now. When you declare a variable outside of a function, it might be declared at the top of the function as a global in order to be used in that function...

php Code:
Original - php Code
  1. $auth_name = "Mike Howard";   
  2. $auth_email = "mhoward@travelbag.co.uk";
  3. $auth_phone = "01420 546371";
  4. $auth_ext = "2371";
  5.  
  6. function page_header()
  7. {
  8. global $auth_name, $auth_email, $auth_phone, $auth_ext;
  9. ?>
  10. <!-- Page written by <?php echo $auth_name ?> (<?php echo "$auth_email / Ext No. $auth_ext / DDI No. $auth_phone" ?>) -->

Reply With Quote
  #9  
Old October 7th, 2002, 02:40 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: None of my scripts work all of a sudden!

Mmm ok not a good example, sorry about that!

I have just quickly written the following 2 files.

test.htm
php Code:
Original - php Code
  1.  
  2. <html>
  3. <head>
  4. <title>Test</title>
  5. </head>
  6. <body>
  7. <form name="test" method="post" action="test.php">
  8. <p>Name : <input type="text" name="name"></p>
  9. </body>
  10. </html>


and

test.php
php Code:
Original - php Code
  1.  
  2. <html>
  3. <head>
  4. <title>Test</title>
  5. </head>
  6. <body>
  7. <p>Hello <?php echo $name ?></p>
  8. </body>
  9. </html>


Rather than test.php echoing out Hello (whatever name is inputted into the text box), I just get Hello

Maybe a better example?

Reply With Quote
  #10  
Old October 7th, 2002, 02:41 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: None of my scripts work all of a sudden!

That really sounds like a register_globals problem. Check phpinfo() and make sure that the ini specified there is the one that you are looking at...

Reply With Quote
  #11  
Old October 7th, 2002, 02:50 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: None of my scripts work all of a sudden!

Yes, the PHP.INI I am using is c:Winntphp.ini

register_globals=on

Reply With Quote
  #12  
Old October 7th, 2002, 03:02 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: None of my scripts work all of a sudden!

in test.php try:

<p>Hello <?php echo $_POST['name'] ?></p>

just to see if the variable is even getting set.

Are you sure there isn't a php.ini in the same directory as php? It could be overriding the one in the c:winnt directory...

Reply With Quote
  #13  
Old October 7th, 2002, 03:09 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: None of my scripts work all of a sudden!

Would you believe...It didn't work.
I have searched for a 2nd php.ini, but there isn't one.
When I press F5 to refresh, it doesn't even come up with the box where you have to press the "Retry" button, it just comes up with "Hello" again.

Any other ideas? As you can imagine, this is becoming a huge problem, I have about 10 big scripts that I run from this server.

Reply With Quote
  #14  
Old October 7th, 2002, 03:39 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24