|
Posted by Andre Dubuc on 02/07/05 19:44
On Monday 07 February 2005 12:06 pm, Alex Gemmell wrote:
> On Sun, 6 Feb 2005 19:36:23 -0500, Andre Dubuc <aajdubuc@webhart.net> wrote:
> > On Sunday 06 February 2005 07:18 pm, Alex Gemmell wrote:
> > > Hello,
> > >
> > > I am building a login system for my website but I keep experiencing an
> > > error on a specific PHP page that I have never encountered before and
> > > it seems worryingly low-level! It says:
> > >
> > > "The remote procedure call failed."
> > >
> > > And that's it! Nothing else is on the page. Sometimes I get a
> > > slightly different (but equally scary) error:
> > >
> > > "PHP has encountered a Stack overflow"
> > >
> > > I've googled these errors and some people have posted them but I found
> > > no solution. I've searched the PHP bug database but found nothing.
> > > Has anyone else encountered this and is there a solution?
> > >
> > > FYI:
> > > Other (more simple) PHP scripts work fine (so my PHP installation seems
> > > to be ok) and this error only started happening last week.
> > >
> > > I haven't changed this PHP/MySQL installation in months.
> > >
> > > I'm testing my script on a (Windows) server in my office on which this
> > > error occurs. When I upload it to a second remote (Linux) test server
> > > it works fine!
> > >
> > > Office Server: Windows 2000 Server + IIS 5.1, PHP Version 4.3.9 (Zend
> > > Engine v1.3.0), MySQL 3.23.49. *CGI Version - I am considering changing
> > > to ISAPI. Would this help do you think?
> > >
> > > Remote Server: Linux + Apache, PHP Version 4.1.2 (Zend Engine v1.1.1),
> > > MySQL 3.23.39.
> > >
> > > Any ideas gratefully received! Thanks,
> > >
> > > Alex
> >
> > First off: register_globals=on on Windows server, register_globals=off in
> > Linux, by any chance? I ran into a similar problem (w/o the 'low-level'
> > messages). Are you calling https for login procedures? Had a problem with
> > that too.
> >
> > Hth,
> > Andre
>
> Thank you Andre! That was spot on - my Windows PHP installation has
> "register_globals"off. When I turned it on the error messages
> disappeared. Success!
>
> FYI: I found this in the PHP manual:
> "If your script uses session_register(), it will not work in
> environments where the PHP directive register_globals is disabled."
>
> I was using session_register() in one place so perhaps this was the
> problem?
>
> PHP manual also says this:
> "Caution
> If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use
> session_register(), session_is_registered(), and
> session_unregister()."
>
> Well, I have a few lines like these two:
>
> session_register('email_address');
> $_SESSION['email_address'] = $email_address;
>
> If I simply delete the first line
> ("session_register('email_address');") everything will still work...
> right?
>
> --
> Alex Gemmell
>
> |:| agemmell@gmail.com |:|
Hi Alex,
I'm glad it worked. Took me long enough to figure it out (and I wasn't
connected to an IE server on the web, but with Linux as well.)
What I suggest: dump any reference to session_register('email_address'); and
use $_SESSION['email_address']; instead.
My method is to convert all $_POST values from the sending script to $_SESSION
AFTER validating user input:
sending page:
<?php session_start(); ?>
<?php
print "<form action='receive.php' method='post'>";
print "<input type='text' name='email_address' value='Email Address Please'>";
/* etc, etc . . . */
?>
receiving page:
<?php session_start(); ?>
<?php
print "<form action='receive.php' method='post'>";
/* Validate user input using standard methods */
$_SESSION['email_address'] = $_POST['email_address'];
/* Then, for ease of wrting it out: */
$email = $_SESSION['email_address'];
/* Lotsa stuff left out here */
?>
Hth,
Andre
[Back to original message]
|