Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 May 2004 09:11:48 +0400
From:      Andrew Karjagin <Andrew.Karjagin@newmail.ru>
To:        <wayne@staff.msen.com>, <freebsd-isp@freebsd.org>
Subject:   Re: PHP issue on FreeBSD
Message-ID:  <20040526051149.25518.qmail@flock1.newmail.ru>
In-Reply-To: <200405251800.i4PI05Mm097989@manor.msen.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello Michael R. Wayne

I have also such problems with PHP 4.3.5 and up with FreeBSD 4.9.
For example, when I use php.ini file, PHP variables (function phpinfo()) doesn't transmitted to php scripts.
When I remove php.ini and restart apache, everything works fine with default php params.
Analog installation on Linux Slackware 8 works fine with php.ini.

Вт, 25.05.2004 22:00:05 you wrote:
>
MRW> 
MRW> I'm mentioning this here becasue the PHP list seems not to have a
MRW> clue and I had someone test this on both Mac and Linux and it works
MRW> OK there.
MRW> 
MRW> I updated a jail running on FreeBSD 4.8 from Apache 1.3.26 PHP 4.1.2
MRW> to Apache 1.3.31 PHP 4.3.6 and sessions broke.  All the gory details
MRW> are included below from a post I made to the PHP list.  I'm looking
MRW> for ideas as to how to debug this, ANY clues would be appreciated.
MRW> 
MRW> /\/\ \/\/
MRW> 
MRW> 
MRW> Session support worked fine in 4.1.2.  It's broken in 4.3.4 and 4.3.6.
MRW> 
MRW> The relevant session variables are:
MRW>    Session Support              enabled  (as per phpinfo)
MRW>    session.auto_start           On or Off (makes no difference)
MRW>    session.use_cookies          Off	<- not using cookies
MRW>    session.name			PHPSESSID
MRW>    session.use_trans_sid        Off	(trans_sid worked with forms in 4.1.2)
MRW>    session.gc_maxlifetime 	1440
MRW> Other things people have asked about:
MRW>    url_rewriter.tags		a=href,area=href,frame=src,input=src,form=fakeentry
MRW> 
MRW> Environment
MRW>    FreeBSD 4.8, Apache/1.3.31 (Unix) PHP/4.3.6 mod_ssl/2.8.17 OpenSSL/0.9.7d 
MRW> 
MRW> The session directory is writable and the files are getting properly
MRW> written to that directory as shown below.
MRW> 
MRW> I invoke the script from a browser and see the following:
MRW>    Stage:0 SessionID: 509012dd5633cba355c270f3934d1201   
MRW>    _______ [Submit]
MRW>    Stage:1 SessionID: 509012dd5633cba355c270f3934d1201
MRW>    Request: Array ( ) 
MRW>    GET: Array ( ) POST: Array ( [field] => ) COOKIE: Array ( ) 
MRW> 
MRW> Checking the session directory, I see an appropriately named file:
MRW>    -rw-------  1 nobody  msen  10 May 25 12:00 sess_509012dd5633cba355c270f3934d1201
MRW> containing
MRW>    stage|i:1;
MRW> The Apache log contains two lines.  The first does not contain the 
MRW> browser version and the second one does:
MRW>    "GET /g/xxx.php HTTP/1.0"
MRW>    "GET /g/xxx.php HTTP/1.0" 200 476 "-" "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.02  [en]"
MRW> 
MRW> So I enter foo in the form and hit Submit.  The browser screen shows
MRW> that the script failed to use the session variable, but it remembers
MRW> it:
MRW>    Stage:0 SessionID: d7002911afdc01a5218e06af2b8f02ad   
MRW>    foo____ [Submit]
MRW>    Stage:1 SessionID: d7002911afdc01a5218e06af2b8f02ad
MRW>    Request: Array ( [PHPSESSID] => 509012dd5633cba355c270f3934d1201 [field] => foo ) 
MRW>    GET: Array ( [PHPSESSID] => 509012dd5633cba355c270f3934d1201 ) POST: Array ( [field] => foo ) COOKIE: Array ( ) 
MRW> The session directory now contains TWO files:
MRW>    -rw-------  1 nobody  msen  10 May 25 12:00 sess_509012dd5633cba355c270f3934d1201
MRW>    -rw-------  1 nobody  msen  10 May 25 12:03 sess_d7002911afdc01a5218e06af2b8f02ad
MRW> each containing:
MRW>    stage|i:1;
MRW> and the Apache log once again has two lines.  The browser has passed back
MRW> the original session ID but PHP has ignored it and assigned a new one.
MRW>    "POST /g/xxx.php?PHPSESSID=509012dd5633cba355c270f3934d1201 HTTP/1.0" 200 605
MRW>    "POST /g/xxx.php?PHPSESSID=509012dd5633cba355c270f3934d1201 HTTP/1.0" 200 605 "http://SERVER/xxx.php" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.05  [en]"
MRW> 
MRW> Now, I hit Submit once more and PHP does manage to re-use the session!  And it
MRW> will continue to do so until the script is re-invoked by another browser:
MRW>    Stage:1 SessionID: d7002911afdc01a5218e06af2b8f02ad   
MRW>    foo____ [Submit]
MRW>    Stage:1 SessionID: d7002911afdc01a5218e06af2b8f02ad
MRW>    Request: Array ( [PHPSESSID] => d7002911afdc01a5218e06af2b8f02ad [field] => foo ) 
MRW>    GET: Array ( [PHPSESSID] => d7002911afdc01a5218e06af2b8f02ad ) POST: Array ( [field] => foo ) COOKIE: Array ( ) 
MRW> the session directory remains unchanged other than access time on the
MRW> reused session:
MRW>    -rw-------  1 nobody  msen  10 May 25 12:00 sess_509012dd5633cba355c270f3934d1201
MRW>    -rw-------  1 nobody  msen  10 May 25 12:13 sess_d7002911afdc01a5218e06af2b8f02ad
MRW> each containing:
MRW>    stage|i:1;
MRW> The Apache log once again contains two lines:
MRW>    "POST /g/xxx.php?PHPSESSID=d7002911afdc01a5218e06af2b8f02ad HTTP/1.0" 200 605
MRW>    "POST /g/xxx.php?PHPSESSID=d7002911afdc01a5218e06af2b8f02ad HTTP/1.0" 200 605 "http://SERVER/xxx.php?PHPSESSID=509012dd5633cba355c270f3934d1201" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.05  [en]"
MRW> 
MRW> And, finally, here is the test script.   Install it as xxx.php if you want to test it:
MRW> 
MRW> <?
MRW>    if (!session_id()) session_start();
MRW>    if (!isset($_SESSION['stage'])) $_SESSION['stage'] = 0;
MRW>    if (!isset($_POST['field']))  $_POST['field'] = ""; 
?>>
MRW> <html><head><title>PHP Test page</title></head><body>
MRW> <?
MRW>    echo "Stage:"; echo $_SESSION['stage'];
MRW>    echo " SessionID: "; echo session_id();
MRW>    $_SESSION['stage'] = 1;
?>>
MRW>    <form method="post" action="xxx.php?<?= SID; ?>">
MRW>       <input type="text" maxlength="7" size="7" name="field" value="<?echo $_POST['field']?>">
MRW>       <input type="submit" value="Submit">
MRW>    </form>
MRW> <?
MRW>    echo "Stage:"; echo $_SESSION['stage']; echo " ";
MRW>    echo " SessionID: "; echo session_id(); echo "<br>";
MRW>    echo " Request: "; print_r($_REQUEST);
MRW>    echo "<br>GET: "; print_r($_GET); echo " POST: "; print_r($_POST); echo " COOKIE: "; print_r($_COOKIE);
MRW> 
?>>
MRW> </body></html>
MRW> 
MRW> _______________________________________________
MRW> freebsd-isp@freebsd.org mailing list
MRW> http://lists.freebsd.org/mailman/listinfo/freebsd-isp
MRW> To unsubscribe, send any mail to "freebsd-isp-unsubscribe@freebsd.org"
MRW> __________

MRW> www.zakaz.orc.ru - доставка карт связи: ОРЦ (IP-телефония, доступ в Интернет, хостинг), МТС, БИ Плюс




__________
www.newmail.ru -- узел свободных коммуникаций.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040526051149.25518.qmail>