Re: [PHP] session_start(), memcache taking too much resources

2011-11-07 Thread Stuart Dallas
On 3 Nov 2011, at 20:22, Ing. Branislav Geržo wrote:

 I am running high loaded website and I did some profiling, because
 webservers got high load. PHP Version 5.3.8, running FreeBSD 8.2-STABLE,
 on lighttpd 1.4.29, running php-fpm on 3 servers
 
 xdebug is showing, that calling line session_start() is taking too
 much time, which I am really surprised. So I think, something is wrong
 with session handler. Please check screenshot:
 
 http://oi42.tinypic.com/24czlu8.jpg
 
 session.save_handler  memcache
 session.save_path
 tcp://web1:11211?persistent=1weight=1timeout=2retry_interval=5,
 tcp://web2:11211?persistent=1weight=1timeout=2retry_interval=5
 
 I am using pecl memcache 3.0.6


Sounds to me like an issue connecting to memcached, possibly DNS-related. How 
is the lookup of web1/web2 being performed? Have you tried the lookup on the 
server?

Alternatively try connecting to the memcached servers using netcat or telnet - 
does that exhibit the same delay?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start(), memcache taking too much resources

2011-11-03 Thread Ing. Branislav Geržo

Hi,

I am running high loaded website and I did some profiling, because
webservers got high load. PHP Version 5.3.8, running FreeBSD 8.2-STABLE,
on lighttpd 1.4.29, running php-fpm on 3 servers

xdebug is showing, that calling line session_start() is taking too
much time, which I am really surprised. So I think, something is wrong
with session handler. Please check screenshot:

http://oi42.tinypic.com/24czlu8.jpg

session.save_handlermemcache
session.save_path
tcp://web1:11211?persistent=1weight=1timeout=2retry_interval=5,
tcp://web2:11211?persistent=1weight=1timeout=2retry_interval=5

I am using pecl memcache 3.0.6

Please advice.

Thanks guys.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] php session_start dead lock

2011-06-24 Thread Zaccone, Warren

We ran the checks and found no problems with the disks.   All disks are 
accessible, there are no I/O errors or disk access errors.   What has me 
bewildered is this started happening quite recently. If it's not hardware, then 
perhaps a new usage pattern is revealing a flaw in our php session handling 
code. 

 I have a suspicion it may be related our use of AJAX.   When a page is loaded 
in the browser we invoke PHP scripts asynchronously while another page may 
still be loading, which could cause two threads at the same time to want to 
lock the same session file in /var/tmp.  I am wondering if such a thing could 
result in a perpetual deadlock in php_flock when invoked from session_start.

We have a PHP script loading a page and from the page we have a javascript 
invoking another php script via Ajax which posts data that refreshes content 
dynamically via the DOM.

The script that is invoked via AJAX is not calling session_start, it is 
invoking session_id() only. Yet it works. It does reuse the same session id as 
we establish context with a database using it.  I am going to play with this 
and see if adding session_start before session_id() in the php script that is 
executed via AJAX may be involved.

When you said, there could be other things -  please share some other ideas.  
perhaps others have seen this? as well as if anyone thinks this theory has 
validity.

 thank you.
 


-Original Message-
From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel Brown
Sent: Thursday, June 23, 2011 3:42 PM
To: Zaccone, Warren
Cc: php-general@lists.php.net
Subject: Re: [PHP] php session_start dead lock

On Thu, Jun 23, 2011 at 15:27, Zaccone, Warren wzacc...@telcordia.com wrote:
 We recently started experiencing a problem on our server (httpd 2.2.19, PHP 
 5.3.6) where all of the apache child processes hang in PHP code and no longer 
 process requests.

  I  am running Apache as prefork on Solaris 10 with 256 children, and found 
 that within a few minutes all 256 httpd child processes are stuck, and it's 
 always in the same place within php_session_start in a php_flock call.   
 Stack trace is shown below.

 The file it is trying to flock is  
 /var/tmp/sess_2e39aabaf226819b67f29da477892e91.

May want to consider fsck'ing that drive, Warren.  You may have
some bad clusters that are causing disk I/O issues.  Just one of many
possibilities, of course, but the least favorite of all, obviously.


-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php session_start dead lock

2011-06-23 Thread Zaccone, Warren
We recently started experiencing a problem on our server (httpd 2.2.19, PHP 
5.3.6) where all of the apache child processes hang in PHP code and no longer 
process requests.

 I  am running Apache as prefork on Solaris 10 with 256 children, and found 
that within a few minutes all 256 httpd child processes are stuck, and it's 
always in the same place within php_session_start in a php_flock call.   Stack 
trace is shown below.

The file it is trying to flock is  
/var/tmp/sess_2e39aabaf226819b67f29da477892e91.

All 256 httpd child processes show the exact same stack trace.  When it occurs 
it eventually (after a long time does timeout) and recover - but it may take 
over 1 hour. We have to stop and restart the server before that.

pstack 6802
6802:   /usr/local/apache/bin/httpd -d /usr/local/apache -f /usr/local/apache/
 feccb880 fcntl(12, 7, ffbfe600)
 fecbb514 fcntl(12, 1, ff172a00, 7d054, fe7845c4, fed303a8) + 84
 fe6f2d88 php_flock (12, 2, 0, 1c80e8, 0, 0) + 58
 fe624e38 ps_files_open (1c9af0, 1c80e8, , fea76238, 1c6738, 100) + 224
 fe625160 ps_read_files (1c9af0, 1c80e8, ffbfeca0, ffbfec9c, 4, fe625148) + 18
 fe622984 php_session_start (18, fffb8bf0, , b800, b400, b800) + bd0
 fe623e34 zif_session_start (0, 1cfeb0, 0, 0, 0, 333f18) + 10
 fe7ca6b8 zend_do_fcall_common_helper_SPEC (333460, b400, feb25e18, 33bd78, 0, 
0) + 76c
 fe7c99e0 execute  (feb25e18, 1c8000, 2f, ffbfeed4, 4, feb24d00) + 210
 fe7a6494 zend_execute_scripts (8, 1, 3, ffbfef40, feb25e18, ffbff4f8) + 12c
 fe74c0c4 php_execute_script (0, feab1f20, 6, 0, 70687000, 0) + 224
 fe83a470 php_handler (32d470, 0, 32d470, c2c00, c3ee0, 9) + 2d0
 000412c8 ap_run_handler (32d470, 3b3b3b3b, 70687000, 80808080, ff00, 80808080)
+ 3c
 0004175c ap_invoke_handler (1668c0, 97400, 32d470, ffbff68c, fddf0028, 0) + c0
 0006c890 ap_process_request (32d470, 0, 4, 32d470, 0, 0) + 160
 00069964 ap_process_http_connection (3276f0, 327458, 327458, b6, c4740, 
e3dc0)+ 10c
 00047a60 ap_run_process_connection (3276f0, 327458, 327458, b6, 3254a0, 
32b428) + 3c
 00087740 child_main (0, 1, c6800, c6c00, 11177, c6800) + 434
 000879a4 make_child (87000, b6, 6, 0, d7300, c6800) + ec
 000883ac ap_mpm_run (c6800, c4400, aa, c6800, c6c00, c6800) + 91c
 0002e2bc main (d17a8, c1800, c3c00, c3c00, cf7a0, 0) + 784
 0002d668 _start   (0, 0, 0, 0, 0, 0) + 5c

# pfiles   6802
6802:   /usr/local/apache/bin/httpd -d /usr/local/apache -f /usr/local/apache/
  Current rlimit: 65536 file descriptors
   0: S_IFCHR mode:0666 dev:340,0 ino:6815752 uid:0 gid:3 rdev:13,2
  O_RDONLY
  /devices/pseudo/mm@0:null
   1: S_IFCHR mode:0666 dev:340,0 ino:6815752 uid:0 gid:3 rdev:13,2
  O_WRONLY|O_CREAT|O_TRUNC
  /devices/pseudo/mm@0:null
   2: S_IFREG mode:0644 dev:85,0 ino:270102 uid:60001 gid:60001 size:3692960
  O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
  /usr/local/apache/logs/error_log
   3: S_IFSOCK mode:0666 dev:347,0 ino:32405 uid:0 gid:0 size:0
  O_RDWR|O_NONBLOCK
SOCK_STREAM

SO_REUSEADDR,SO_KEEPALIVE,SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0.0.192.0)
sockname: AF_INET 0.0.0.0  port: 80
   4: S_IFDOOR mode:0444 dev:349,0 ino:55 uid:0 gid:0 size:0
  O_RDONLY|O_LARGEFILE FD_CLOEXEC  door to nscd[170]
  /var/run/name_service_door
   5: S_IFCHR mode:0620 dev:340,0 ino:12582920 uid:0 gid:7 rdev:24,2
  O_RDWR
  /devices/pseudo/pts@0:2
   6: S_IFSOCK mode:0666 dev:347,0 ino:52766 uid:0 gid:0 size:0
  O_RDWR|O_NONBLOCK
SOCK_STREAM
SO_REUSEADDR,SO_KEEPALIVE,SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0
.0.192.0)
sockname: AF_INET 0.0.0.0  port: 443
   7: S_IFIFO mode: dev:338,0 ino:2827255 uid:0 gid:1 size:0
  O_RDWR|O_NONBLOCK
   8: S_IFIFO mode: dev:338,0 ino:2827255 uid:0 gid:1 size:0
  O_RDWR
   9: S_IFREG mode:0644 dev:85,0 ino:270103 uid:60001 gid:60001 size:601185983
  O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
  /usr/local/apache/logs/access_log
  10: S_IFREG mode:0644 dev:85,0 ino:270103 uid:60001 gid:60001 size:601185983
  O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
  /usr/local/apache/logs/access_log
  11: S_IFREG mode:0644 dev:85,0 ino:270104 uid:60001 gid:60001 size:2151
  O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE
  /usr/local/apache/logs/ssl_request_log
  12: S_IFREG mode:0644 dev:85,0 ino:270797 uid:0 gid:1 size:0
  O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE
  13: S_IFCHR mode: dev:340,0 ino:18026 uid:0 gid:0 rdev:21,622
  O_WRONLY FD_CLOEXEC
  /devices/pseudo/log@0:conslog
  14: S_IFREG mode:0644 dev:85,0 ino:270798 uid:0 gid:1 size:0
  O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE
  15: S_IFPORT mode: dev:350,0 uid:60001 gid:60001 size:0
  16: S_IFSOCK mode:0666 dev:347,0 ino:19961 uid:0 gid:0 size:0
  O_RDWR|O_NONBLOCK
SOCK_STREAM

SO_REUSEADDR,SO_KEEPALIVE,SO_SNDBUF(49152),SO_RCVBUF(49640),IP_NEXTHOP(0.0.193.232)
sockname: AF_INET 128.96.156.65  port: 80
peername: AF_INET 128.96.195.58  

Re: [PHP] php session_start dead lock

2011-06-23 Thread Daniel Brown
On Thu, Jun 23, 2011 at 15:27, Zaccone, Warren wzacc...@telcordia.com wrote:
 We recently started experiencing a problem on our server (httpd 2.2.19, PHP 
 5.3.6) where all of the apache child processes hang in PHP code and no longer 
 process requests.

  I  am running Apache as prefork on Solaris 10 with 256 children, and found 
 that within a few minutes all 256 httpd child processes are stuck, and it's 
 always in the same place within php_session_start in a php_flock call.   
 Stack trace is shown below.

 The file it is trying to flock is  
 /var/tmp/sess_2e39aabaf226819b67f29da477892e91.

May want to consider fsck'ing that drive, Warren.  You may have
some bad clusters that are causing disk I/O issues.  Just one of many
possibilities, of course, but the least favorite of all, obviously.


-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start() may take 5 seconds :(

2011-03-31 Thread Tolas Anon
My web-app sometimes takes just over 5 seconds to execute a single
start_session() statement.
No other connections are open to the site when i hit the button that
makes this happen, the session is just 78kb on a local disk, and it's
consistent behavior.
So far, it only happens when i request certain page content via AJAX,
but I'd like to get rid of it asap.
Strangely, some other page content requested under the same conditions
via the same pipeline returns without the delay. It doesn't do
anything differently except the business code, and the session is
opened in app-wide generic code that is executed before the business
code is executed. The very timing with microtime() happens before the
business code executes.

I've already googled, but haven't found anything useful.

It's on a windows box (latest wampserver) and due to a ubuntu firefox
limitation i can't test on linux at the moment, nor run strace on it
:(

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() may take 5 seconds :(

2011-03-31 Thread Negin Nickparsa
session1.php:
?php
session_start();
$_SESSION['s1']='sth';
header(location: session2.php?.SID);
?
session2.php:
?php
session_start();
if(isset($_SESSION['s1']))
echo $_SESSION['s1'];
else
die(No session!);
?


Re: [PHP] session_start() may take 5 seconds :(

2011-03-31 Thread Tolas Anon
On Thu, Mar 31, 2011 at 8:10 AM, Negin Nickparsa nickpa...@gmail.com wrote:
 session1.php:
 ?php
 session_start();
 $_SESSION['s1']='sth';
 header(location: session2.php?.SID);
 ?
 session2.php:
 ?php
 session_start();
 if(isset($_SESSION['s1']))
 echo $_SESSION['s1'];
 else
 die(No session!);
 ?



ok, that executes with success and fast..

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-14 Thread tedd

At 3:50 PM +0100 1/13/08, Jochem Maas wrote:

to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.

- 8 info.php 
?php

phpinfo();
- 8 info.php 


It may be a religious argument, but I always close my scripts and I 
know where the white space is.


Also, most of my code is used by other languages (i.e., html, js) so 
a closing bracket is always required -- unless it's the last function 
in a file, but I haven't checked to see if that works in all cases. 
So, I just always close it correctly.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Jochem Maas

Terry Calie schreef:

...



To illustrate my php goes like this:

index.php
=
?php
code
code
require index2.php
code
?

index2.php

?php
code
code
code
?
whitespace character


...

to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.

- 8 info.php 
?php

phpinfo();
- 8 info.php 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Europus

Jochem Maas wrote:


?
whitespace character

...
to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.
- 8 info.php 
?php

phpinfo();
- 8 info.php 


I didn't know that. Does the underlying engine in PHP provide the
otherwise missing tag? Does the described problem only happen with
FF on Mac or does it affect other browsers on other OSes?

Ulex

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Jochem Maas

Europus schreef:

Jochem Maas wrote:


?
whitespace character

...
to avoid this in future never add the closing php bracket to the end of
the php file (unless you explicitly want to output something after the
code in question - which is almost never the case), it is not required.

e.g.
- 8 info.php 
?php

phpinfo();
- 8 info.php 


I didn't know that. Does the underlying engine in PHP provide the
otherwise missing tag? 


the tag is not missing as such - the tag denotes the end of string that
php parses - it's quite logical to assume that the end of a file means the same
thing (especially when you consider that any file you include/require
must specify '?php' to 'awaken' the php parser)


Does the described problem only happen with
FF on Mac or does it affect other browsers on other OSes?


I have never seen this problem effect just one browser on on platform -
afaic it's a general problem that effects all browsers - you can't send
out HTTP headers after HTTP content ... now it maybe that some browsers
these days see fit to ignore white space before the headers (or maybe
just ignore a \n) but I doubt it ... honestly I can't see how php
would even send the headers after the \n had been output ... either
you error logging level is too low, your not reading the error log or you
have error suppression on the header() function (.e.g @header()). all
of these would give you the incorrect notion that the header function
was working, all of these are bad practice.

you also mentioned you changed the code when trying to test it on another
machine - don't do that, test one thing at a time.

anyway problem solved, preventative knowledge aquired, onto the next hurdle :-)



Ulex



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Europus

 Jochem Maas wrote:


you also mentioned you changed the code when trying to test it on another
machine - don't do that, test one thing at a time.


I'm not the original poster, that wasn't me.

anyway problem solved, preventative knowledge aquired, onto the next 
hurdle :-)


I'm having some trouble with a for() loop and echoing array results
to screen to see if I'm getting the data I'm after, I may post about
it later.

Ulex

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-13 Thread Jochem Maas

Europus schreef:

 Jochem Maas wrote:


you also mentioned you changed the code when trying to test it on another
machine - don't do that, test one thing at a time.


I'm not the original poster, that wasn't me.

anyway problem solved, preventative knowledge aquired, onto the next 
hurdle :-)


I'm having some trouble with a for() loop and echoing array results
to screen to see if I'm getting the data I'm after, I may post about
it later.


use var_dump() rather than echo.



Ulex



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-12 Thread Terry Calie
Hey... thanks for the replies.  I installed the headers feature that 
Richard suggested and found that no headers were output. 

I started to transfer my php to another site to see if the problem 
replicated and I wasn't able to recreate the problem.  

It turns out that I require a file before the session_start that had 
one stupid character of whitespace at the end of it.  When I transferred 
the php to recreate the problem, I replaced the require call with the 
actual code - eliminating the whitespace at the end of the file, so the 
problem didn't replicate.  It took me a long time to figure out that was 
the problem.  What a killer!


To illustrate my php goes like this:

index.php
=
?php
code
code
require index2.php
code
?

index2.php

?php
code
code
code
?
whitespace character

The whitespace character is actually just an extra newline \n at the 
end of the file.  So that gets output to the browser before the headers 
and apparently doesn't lock up any browsers except FireFox on a Mac.


Thanks for the help.  Just your courtesy in responses got me thinking in 
a new direction.

Terry




Richard Lynch wrote:

Install Live HTTP Headers and see what headers are being sent.

Then search for those headers and FireFox Mac issues online.

On Fri, January 11, 2008 10:34 am, Terry Calie wrote:
  

Sorry if this is the wrong place to ask this question... if so please
help me figure out where to ask it.  I've asked on FireFox forums and
was told it was a PHP problem and to ask the developers of PHP.

I have a PHP website that freezes in Firefox on a Mac.  Every other
browser/operating system combination I have tested is fine.  I've
narrowed down the problem to having to do with session_start, which
is
the session tracking mechanism for php.

When I comment out session_start, the site works (but of course my
site
now becomes state-less).  Again, the problem is ONLY on FireFox on a
Mac.  It works fine on FireFox on a PC.

Any ideas as to what could be causing the problem with FireFox on Mac
and not on PC?  (Safari on Mac works fine)

Thanks,
Terry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-12 Thread Anup Shukla

Terry Calie wrote:
Hey... thanks for the replies.  I installed the headers feature that 
Richard suggested and found that no headers were output.
I started to transfer my php to another site to see if the problem 
replicated and I wasn't able to recreate the problem. 
It turns out that I require a file before the session_start that had 
one stupid character of whitespace at the end of it.  When I transferred 
the php to recreate the problem, I replaced the require call with the 
actual code - eliminating the whitespace at the end of the file, so the 
problem didn't replicate.  It took me a long time to figure out that was 
the problem.  What a killer!




You may use ob_clean() just before the header()
to get rid of the extra whitespaces.

--
Regards,
Anup Shukla

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Daniel Brown
On Jan 11, 2008 11:53 AM, Jason Pruim [EMAIL PROTECTED] wrote:
 With a problem like that, code and a web page are very helpful to
 track it down. I'm willing to take a look at what I can with my Mac 
 firefox, and see what I can sort out :)

 I just need more info..



 On Jan 11, 2008, at 11:34 AM, Terry Calie wrote:

  Sorry if this is the wrong place to ask this question... if so
  please help me figure out where to ask it.  I've asked on FireFox
  forums and was told it was a PHP problem and to ask the developers
  of PHP.
 
  I have a PHP website that freezes in Firefox on a Mac.  Every other
  browser/operating system combination I have tested is fine.  I've
  narrowed down the problem to having to do with session_start,
  which is the session tracking mechanism for php.
 
  When I comment out session_start, the site works (but of course my
  site now becomes state-less).  Again, the problem is ONLY on FireFox
  on a Mac.  It works fine on FireFox on a PC.
 
  Any ideas as to what could be causing the problem with FireFox on
  Mac and not on PC?  (Safari on Mac works fine)

Terry,

I had seen your posts before (I'm a Mozilla developer as well),
but I didn't see mention of a version.  What Mac FF version are you
using, and what plugins do you have installed?  Try disabling all
plugins, restarting Firefox, and seeing if it will work for you then.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Jason Pruim
With a problem like that, code and a web page are very helpful to  
track it down. I'm willing to take a look at what I can with my Mac   
firefox, and see what I can sort out :)


I just need more info..


On Jan 11, 2008, at 11:34 AM, Terry Calie wrote:

Sorry if this is the wrong place to ask this question... if so  
please help me figure out where to ask it.  I've asked on FireFox  
forums and was told it was a PHP problem and to ask the developers  
of PHP.


I have a PHP website that freezes in Firefox on a Mac.  Every other  
browser/operating system combination I have tested is fine.  I've  
narrowed down the problem to having to do with session_start,  
which is the session tracking mechanism for php.


When I comment out session_start, the site works (but of course my  
site now becomes state-less).  Again, the problem is ONLY on FireFox  
on a Mac.  It works fine on FireFox on a PC.


Any ideas as to what could be causing the problem with FireFox on  
Mac and not on PC?  (Safari on Mac works fine)


Thanks,
Terry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Terry Calie
Sorry if this is the wrong place to ask this question... if so please 
help me figure out where to ask it.  I've asked on FireFox forums and 
was told it was a PHP problem and to ask the developers of PHP.


I have a PHP website that freezes in Firefox on a Mac.  Every other 
browser/operating system combination I have tested is fine.  I've 
narrowed down the problem to having to do with session_start, which is 
the session tracking mechanism for php.


When I comment out session_start, the site works (but of course my site 
now becomes state-less).  Again, the problem is ONLY on FireFox on a 
Mac.  It works fine on FireFox on a PC.


Any ideas as to what could be causing the problem with FireFox on Mac 
and not on PC?  (Safari on Mac works fine)


Thanks,
Terry

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start problems with FireFox on Mac

2008-01-11 Thread Richard Lynch
Install Live HTTP Headers and see what headers are being sent.

Then search for those headers and FireFox Mac issues online.

On Fri, January 11, 2008 10:34 am, Terry Calie wrote:
 Sorry if this is the wrong place to ask this question... if so please
 help me figure out where to ask it.  I've asked on FireFox forums and
 was told it was a PHP problem and to ask the developers of PHP.

 I have a PHP website that freezes in Firefox on a Mac.  Every other
 browser/operating system combination I have tested is fine.  I've
 narrowed down the problem to having to do with session_start, which
 is
 the session tracking mechanism for php.

 When I comment out session_start, the site works (but of course my
 site
 now becomes state-less).  Again, the problem is ONLY on FireFox on a
 Mac.  It works fine on FireFox on a PC.

 Any ideas as to what could be causing the problem with FireFox on Mac
 and not on PC?  (Safari on Mac works fine)

 Thanks,
 Terry

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start is slow occasionally

2007-10-04 Thread al jo
Hi i have a site that is relatively high loaded (~20 reloads/sec) and i am 
trying to optimize it.
So i have started timing sections of the php scripts to find out which is the 
slowest so i optimize it first. I write the times to a database( timings are 
done on the live server). So now when  a user reloads the page (timings are set 
on only one of the pages) i write to the database how long it took and how long 
different sections take. That way i noticed thar occasionally that page takes 
extremely long to generate (there are occasions of  300sec), but generally it 
takes between 0.05 and 0.2 sec to generate. I started moving the sections to 
determine where the problem lies and it turned out that these three lines take 
that long from time to time:
ini_set(session.gc_maxlifetime, 2400);
session_name('x');
session_start();

I measured each of them and seems that session_start is the problem(had a few 
~11 sec loads, but not something this big yet, of which ~10.5 is taking 
session_start)
Does anyone know what is going on? Sessions are stored in /tmp/sessions/ which 
is 100MB ram drive and at the moment when this occurs it was ~68% used with 
~12000 files in it.

And i have one more question. How does apache handle high loads? Does it 
suspend the php script when there are no resources and resume it when it frees 
some, or it doesn't pick it up at all?

Thank you

   
-
Pinpoint customers who are looking for what you sell. 

Re: [PHP] session_start is slow occasionally

2007-10-04 Thread Chris

al jo wrote:

Hi i have a site that is relatively high loaded (~20 reloads/sec) and i am 
trying to optimize it.
So i have started timing sections of the php scripts to find out which is the 
slowest so i optimize it first. I write the times to a database( timings are done 
on the live server). So now when  a user reloads the page (timings are set on only 
one of the pages) i write to the database how long it took and how long different 
sections take. That way i noticed thar occasionally that page takes extremely long 
to generate (there are occasions of  300sec), but generally it takes between 
0.05 and 0.2 sec to generate. I started moving the sections to determine where the 
problem lies and it turned out that these three lines take that long from time to 
time:
ini_set(session.gc_maxlifetime, 2400);
session_name('x');
session_start();

I measured each of them and seems that session_start is the problem(had a few 
~11 sec loads, but not something this big yet, of which ~10.5 is taking 
session_start)
Does anyone know what is going on? Sessions are stored in /tmp/sessions/ which 
is 100MB ram drive and at the moment when this occurs it was ~68% used with 
~12000 files in it.


My suggestion is check the php source for what session_start does. Maybe 
it scans the directory to make sure it's going to generate a unique id 
and even though it's on a ram drive it's taking a while because of the 
number of files already there.


That's just a completely wild guess though ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start(): Cannot send session cache limiter...

2007-08-05 Thread Nisse Engström
On Fri, 20 Jul 2007 16:39:51 -0500 (CDT), Richard Lynch wrote:

 Did you save it as UTF-8 with that byte-order-mark (BOM) thingie?
 
 Does UTF-8 even HAVE a BOM?

http://www.unicode.org/Public/UNIDATA/Index.txt:

  byte order markFEFF


U+FEFF is ef bb bf in UTF-8.


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start(): Cannot send session cache limiter...

2007-07-21 Thread Wesley Acheson

From: Richard Lynch [EMAIL PROTECTED]
To: Vanessa Vega [EMAIL PROTECTED]
Date: Fri, 20 Jul 2007 16:39:51 -0500 (CDT)
Subject: Re: [PHP] session_start(): Cannot send session cache limiter...


On Fri, July 20, 2007 3:17 am, Paul Scott wrote:

 On Fri, 2007-07-20 at 16:01 +0800, Vanessa Vega wrote:
 I already put session_start() on topmost part of the file..but i
 saved the
 file as utf-8..and that seems to be the problem..can anyone share
 their
 knowledge on this?

 Set your error_reporting to at least E_ALL and check that there are no
 problems there first. That should give you more of a clue as to what
 is
 happening.


Did you save it as UTF-8 with that byte-order-mark (BOM) thingie?

Does UTF-8 even HAVE a BOM?

I believe a BOM has messed others up in the past.

Perhaps Google for your problem before posting will find an answer
quicker... :-)

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?



I believe on Windows with word for example it inserts a byte order
mark incorrectly.  \ufeff.  is what it comes out if I run the
native2ascii program.This isn't technically correct behaviour and it
shouldn't occur.

Regards,

Wesley Acheson

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start(): Cannot send session cache limiter...

2007-07-20 Thread Vanessa Vega
Hello to all!

I encountered this error when the site is uploaded on the server:

session_start(): Cannot send session cache limiter - headers already 
sent

I already put session_start() on topmost part of the file..but i saved the 
file as utf-8..and that seems to be the problem..can anyone share their 
knowledge on this?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start(): Cannot send session cache limiter...

2007-07-20 Thread Paul Scott

On Fri, 2007-07-20 at 16:01 +0800, Vanessa Vega wrote:
 I already put session_start() on topmost part of the file..but i saved the 
 file as utf-8..and that seems to be the problem..can anyone share their 
 knowledge on this?
 
Set your error_reporting to at least E_ALL and check that there are no
problems there first. That should give you more of a clue as to what is
happening.

--Paul 

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] session_start(): Cannot send session cache limiter...

2007-07-20 Thread Richard Lynch


On Fri, July 20, 2007 3:17 am, Paul Scott wrote:

 On Fri, 2007-07-20 at 16:01 +0800, Vanessa Vega wrote:
 I already put session_start() on topmost part of the file..but i
 saved the
 file as utf-8..and that seems to be the problem..can anyone share
 their
 knowledge on this?

 Set your error_reporting to at least E_ALL and check that there are no
 problems there first. That should give you more of a clue as to what
 is
 happening.


Did you save it as UTF-8 with that byte-order-mark (BOM) thingie?

Does UTF-8 even HAVE a BOM?

I believe a BOM has messed others up in the past.

Perhaps Google for your problem before posting will find an answer
quicker... :-)

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session_Start() error

2007-03-05 Thread Helder Lopes

*hi people,

Hi have this error in the session cookie, how to solve this???

Warning*: session_start()
[function.session-starthttp://localhost/function.session-start]:
Cannot send session cache limiter - headers already sent (output started at
D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on
line *3*


Re: [PHP] Session_Start() error

2007-03-05 Thread Rabih Tayyem

Hi,
just put session_start()  (first line) the first thing in your php file and
this should solve the problem.

Regards,
Rabih


On 3/5/07, Helder Lopes [EMAIL PROTECTED] wrote:


*hi people,

Hi have this error in the session cookie, how to solve this???

Warning*: session_start()
[function.session-starthttp://localhost/function.session-start]:
Cannot send session cache limiter - headers already sent (output started
at
D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on
line *3*



Re: [PHP] Session_Start() error

2007-03-05 Thread datsclark
Also make sure you don't have empty lines before the ?php or ? tags


Helder Lopes [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 *hi people,

 Hi have this error in the session cookie, how to solve this???

 Warning*: session_start()
 [function.session-starthttp://localhost/function.session-start]:
 Cannot send session cache limiter - headers already sent (output started 
 at
 D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on
 line *3*
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_Start() error

2007-03-05 Thread Jochem Maas
Helder Lopes wrote:
 *hi people,
 
 Hi have this error in the session cookie, how to solve this???

did you read the error message? did you look up the lines
specified in the error message? did you read the manual pages related to
sessions and session functions?

headers have already been sent because output has already been sent,
you can't send headers after output has been sent out - so don't do that.

 
 Warning*: session_start()
 [function.session-starthttp://localhost/function.session-start]:
 Cannot send session cache limiter - headers already sent (output started at
 D:\PHP\xampp\htdocs\index.php:10) in *D:\PHP\xampp\htdocs\verifica.php* on
 line *3*
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] R: [PHP] session_start() and fopen

2006-09-15 Thread Richard Lynch
On Thu, September 14, 2006 1:17 pm, Fabri wrote:
 Hi Christopher: this is just a simplified code, I use it to generate
 some
 xml file, no loop is present.

 Try it as it is: you will find that two files will be generated while
 it
 should be only one.
 If you remove 'session_start()' then only one file will be generated:
 that's
 correct!

I suspect you are seeing a browser issue...

If your browser chooses to access the URL twice, just to get the
content, there's not much PHP can do about that...

It's only triggered by the session_start() because the browser is
stoopid about cookies, in some fashion.

Since all browsers are stoopid about cookies in some fashion, this
should come as no surprise. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] R: [PHP] session_start() and fopen

2006-09-14 Thread Fabri
Hi Christopher: this is just a simplified code, I use it to generate some
xml file, no loop is present.

Try it as it is: you will find that two files will be generated while it
should be only one.
If you remove 'session_start()' then only one file will be generated: that's
correct!

Fabri 

-Messaggio originale-
Da: Christopher Weldon [mailto:[EMAIL PROTECTED] 
Inviato: mercoledì 13 settembre 2006 22.28
A: Fabri
Cc: php-general@lists.php.net
Oggetto: Re: [PHP] session_start() and fopen

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
 Hello, would you please help me on this issue that is making me crazy?
 
  
 
  
 
 I start a session with session_start() and I need to write a file, the
file
 is written twice! If I remove session_start the code works obviously fine.
 
 I used  the date as name of file so I can see the problem, otherwise the
 file is overwritten.
 
  
 
 session_start();
 
 $nome = date(Ymd-His);
 
 $path = $nome . .xml;
 
 $fh = fopen($path, 'w');
 
 if ($fh) {
 
 fwrite($fh, 'ciao');
 
 fclose($fh);
 
 echo $path;
 
 } 
 
  
 
 does someone have an answer?
 
 

Yes, I believe you need to elaborate more on your objectives for the
code and what exactly you mean by the file being written twice. From the
code snippet above, it seems as though you are just going to overwrite a
file and destroy it's contents, not write to it twice.

This isn't being called from any sort of loop, is it?

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCGnIZxvk7JEXkbERAj4OAKCVUc3lLkx7JcbwYavK/Qc/DYKtEQCfbU9w
EevaaQyHxc87B7qFwZxS0E4=
=BbS2
-END PGP SIGNATURE-

Chiacchiera con i tuoi amici in tempo reale!
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] R: [PHP] session_start() and fopen

2006-09-14 Thread Christopher Weldon
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
 Hi Christopher: this is just a simplified code, I use it to generate some
 xml file, no loop is present.
 
 Try it as it is: you will find that two files will be generated while it
 should be only one.
 If you remove 'session_start()' then only one file will be generated: that's
 correct!
 
 Fabri 

Hey Fabri,

I cannot replicate this bug (PHP 4.2.3 on older server). I'm only
getting one file written. What version of PHP are you using?

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCa33Zxvk7JEXkbERAkT6AJwODHyP1uvE7UjlAOsjSlTf83LS0ACgifny
XRbhB2bRYZsKCvCl09QLkS0=
=lSIJ
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] R: [PHP] R: [PHP] session_start() and fopen

2006-09-14 Thread Fabri
Hi Chris,
thanks for your feedback: at least now I know that the script is correct, I
am using version 4.3.10, I will investigate if some bug is present in this
version.

Fabri

-Messaggio originale-
Da: Christopher Weldon [mailto:[EMAIL PROTECTED] 
Inviato: giovedì 14 settembre 2006 21.31
A: Fabri
Cc: php-general@lists.php.net
Oggetto: Re: [PHP] R: [PHP] session_start() and fopen

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
 Hi Christopher: this is just a simplified code, I use it to generate some
 xml file, no loop is present.
 
 Try it as it is: you will find that two files will be generated while it
 should be only one.
 If you remove 'session_start()' then only one file will be generated:
that's
 correct!
 
 Fabri 

Hey Fabri,

I cannot replicate this bug (PHP 4.2.3 on older server). I'm only
getting one file written. What version of PHP are you using?

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCa33Zxvk7JEXkbERAkT6AJwODHyP1uvE7UjlAOsjSlTf83LS0ACgifny
XRbhB2bRYZsKCvCl09QLkS0=
=lSIJ
-END PGP SIGNATURE-

Chiacchiera con i tuoi amici in tempo reale!
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start() and fopen

2006-09-13 Thread Fabri
Hello, would you please help me on this issue that is making me crazy?

 

 

I start a session with session_start() and I need to write a file, the file
is written twice! If I remove session_start the code works obviously fine.

I used  the date as name of file so I can see the problem, otherwise the
file is overwritten.

 

session_start();

$nome = date(Ymd-His);

$path = $nome . .xml;

$fh = fopen($path, 'w');

if ($fh) {

fwrite($fh, 'ciao');

fclose($fh);

echo $path;

} 

 

does someone have an answer?



Re: [PHP] session_start() and fopen

2006-09-13 Thread Curt Zirzow

On 9/13/06, Fabri [EMAIL PROTECTED] wrote:

Hello, would you please help me on this issue that is making me crazy?


I'll try



I start a session with session_start() and I need to write a file, the file
is written twice! If I remove session_start the code works obviously fine.


This has never happened to me, ever.



I used  the date as name of file so I can see the problem, otherwise the
file is overwritten.


What exactly are you trying to do?





session_start();
$nome = date(Ymd-His);
$path = $nome . .xml;

$fh = fopen($path, 'w');
if ($fh) {
fwrite($fh, 'ciao');
fclose($fh);
echo $path;
}


for full reporting you might want to do something when the condition
of if($fh) is false



does someone have an answer?


I'm not sure what else to tell you.


Curt.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() and fopen

2006-09-13 Thread Christopher Weldon
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Fabri wrote:
 Hello, would you please help me on this issue that is making me crazy?
 
  
 
  
 
 I start a session with session_start() and I need to write a file, the file
 is written twice! If I remove session_start the code works obviously fine.
 
 I used  the date as name of file so I can see the problem, otherwise the
 file is overwritten.
 
  
 
 session_start();
 
 $nome = date(Ymd-His);
 
 $path = $nome . .xml;
 
 $fh = fopen($path, 'w');
 
 if ($fh) {
 
 fwrite($fh, 'ciao');
 
 fclose($fh);
 
 echo $path;
 
 } 
 
  
 
 does someone have an answer?
 
 

Yes, I believe you need to elaborate more on your objectives for the
code and what exactly you mean by the file being written twice. From the
code snippet above, it seems as though you are just going to overwrite a
file and destroy it's contents, not write to it twice.

This isn't being called from any sort of loop, is it?

- --
Christopher Weldon, ZCE
President  CEO
Cerberus Interactive, Inc.
[EMAIL PROTECTED]
979.739.5874
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFCGnIZxvk7JEXkbERAj4OAKCVUc3lLkx7JcbwYavK/Qc/DYKtEQCfbU9w
EevaaQyHxc87B7qFwZxS0E4=
=BbS2
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start/session_write_close creates multiple sessioncookieheaders. How to fix this.

2006-07-20 Thread Mathijs

Chris wrote:

Mathijs wrote:

Chris wrote:

Mathijs wrote:

Hello again,

I Use session_write_close() so the page loads quicker because i use 
session on multiple place.

This because session has protection for race conditions.

Now it works very well and i don't have any problems at all.
I only see that there are multiple session cookie headers set.
I Personally think that one is enough :P.

How can i make it so that it just sets just one and not set this 
header every time i call session_start or session_write_close.

Because i don't know when the cookie is set.


I think this will be an either/or situation.

Either it only sends one session cookie header and you don't use 
session_write_close all over the place..


or, it sends multiple cookies and you do use session_write_close all 
over the place.


The internals of php would set this behaviour, not something you can 
change without changing the C code.




Hmmm...
I find it kinda strange that it sets the same uniqueId with the same 
session name more then once.
It would be logical to just have one.. And overwrite the previous 
session cookie.

Any other thing would be an programmers fault in my opinion.
Because you can't have more then one session id per session cookie name.
Also, the browser won't send all the cookies back.
This is just useless overhead.

But it seems that i have to live with it (for now).
I think ill report this as an bug to PHP.


Doubt you'll get very far.

I could open 10 tabs in firefox and I'll have the same session id in 
each one, but they'll all be on different pages doing different things.


Even in IE, if I open a new page I'll get the same session id in both 
browser windows.



That is a good thing.
But the problem is that there are like 5 or 6 headers for one request.


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0629-1, 07/19/2006
Tested on: 7/20/2006 8:56:33 AM
avast! - copyright (c) 1988-2006 ALWIL Software.
http://www.avast.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start/session_write_close creates multiple sessioncookie headers. How to fix this.

2006-07-16 Thread Chris

Mathijs wrote:

Chris wrote:

Mathijs wrote:

Hello again,

I Use session_write_close() so the page loads quicker because i use 
session on multiple place.

This because session has protection for race conditions.

Now it works very well and i don't have any problems at all.
I only see that there are multiple session cookie headers set.
I Personally think that one is enough :P.

How can i make it so that it just sets just one and not set this 
header every time i call session_start or session_write_close.

Because i don't know when the cookie is set.


I think this will be an either/or situation.

Either it only sends one session cookie header and you don't use 
session_write_close all over the place..


or, it sends multiple cookies and you do use session_write_close all 
over the place.


The internals of php would set this behaviour, not something you can 
change without changing the C code.




Hmmm...
I find it kinda strange that it sets the same uniqueId with the same 
session name more then once.
It would be logical to just have one.. And overwrite the previous 
session cookie.

Any other thing would be an programmers fault in my opinion.
Because you can't have more then one session id per session cookie name.
Also, the browser won't send all the cookies back.
This is just useless overhead.

But it seems that i have to live with it (for now).
I think ill report this as an bug to PHP.


Doubt you'll get very far.

I could open 10 tabs in firefox and I'll have the same session id in 
each one, but they'll all be on different pages doing different things.


Even in IE, if I open a new page I'll get the same session id in both 
browser windows.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start/session_write_close creates multiple sessioncookie headers. How to fix this.

2006-07-14 Thread Mathijs

Chris wrote:

Mathijs wrote:

Hello again,

I Use session_write_close() so the page loads quicker because i use 
session on multiple place.

This because session has protection for race conditions.

Now it works very well and i don't have any problems at all.
I only see that there are multiple session cookie headers set.
I Personally think that one is enough :P.

How can i make it so that it just sets just one and not set this 
header every time i call session_start or session_write_close.

Because i don't know when the cookie is set.


I think this will be an either/or situation.

Either it only sends one session cookie header and you don't use 
session_write_close all over the place..


or, it sends multiple cookies and you do use session_write_close all 
over the place.


The internals of php would set this behaviour, not something you can 
change without changing the C code.




Hmmm...
I find it kinda strange that it sets the same uniqueId with the same session 
name more then once.
It would be logical to just have one.. And overwrite the previous session 
cookie.
Any other thing would be an programmers fault in my opinion.
Because you can't have more then one session id per session cookie name.
Also, the browser won't send all the cookies back.
This is just useless overhead.

But it seems that i have to live with it (for now).
I think ill report this as an bug to PHP.

Thx.
Mathijs.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start/session_write_close creates multiple session cookie headers. How to fix this.

2006-07-13 Thread Mathijs

Hello again,

I Use session_write_close() so the page loads quicker because i use session on 
multiple place.
This because session has protection for race conditions.

Now it works very well and i don't have any problems at all.
I only see that there are multiple session cookie headers set.
I Personally think that one is enough :P.

How can i make it so that it just sets just one and not set this header every 
time i call session_start or session_write_close.
Because i don't know when the cookie is set.

Thx in advance.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start/session_write_close creates multiple session cookie headers. How to fix this.

2006-07-13 Thread Chris

Mathijs wrote:

Hello again,

I Use session_write_close() so the page loads quicker because i use 
session on multiple place.

This because session has protection for race conditions.

Now it works very well and i don't have any problems at all.
I only see that there are multiple session cookie headers set.
I Personally think that one is enough :P.

How can i make it so that it just sets just one and not set this header 
every time i call session_start or session_write_close.

Because i don't know when the cookie is set.


I think this will be an either/or situation.

Either it only sends one session cookie header and you don't use 
session_write_close all over the place..


or, it sends multiple cookies and you do use session_write_close all 
over the place.


The internals of php would set this behaviour, not something you can 
change without changing the C code.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start

2006-04-06 Thread Diana Castillo
If I have nothing in $session_id, why do I get this message when I do a 
session_start() ?
Warning: session_start(): The session id contains invalid characters, valid 
characters are only a-z, A-Z and 0-9 at 
C:\Inetpub\wwwroot\usr\local\global\php\online\InterfaceManager.php line 
149.


-- 
Diana Castillo
Destinia.com
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start

2006-04-06 Thread Anthony Ettinger
because you have nothing in $session_id.

On 4/6/06, Diana Castillo [EMAIL PROTECTED] wrote:
 If I have nothing in $session_id, why do I get this message when I do a
 session_start() ?
 Warning: session_start(): The session id contains invalid characters, valid
 characters are only a-z, A-Z and 0-9 at
 C:\Inetpub\wwwroot\usr\local\global\php\online\InterfaceManager.php line
 149.


 --
 Diana Castillo
 Destinia.com
 C/Granvia 22 dcdo 4-dcha
 28013 Madrid-Spain
 Tel : 00-34-913604039 Ext 216
 Fax : 00-34-915228673
 email: [EMAIL PROTECTED]
 Web : http://www.hotelkey.com
   http://www.destinia.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start(), Pragma and Cache-control headers

2005-08-22 Thread Kim Steinhaug \(php list\)
Hello,

I'm working on a downbload script which serves M3U
files (Winamp playlist files) through a PHP file
like this :

somepath/download.m3u.php?id=2

Then in the PHP script I generate the M3U file, and
serve up the headers I want. Swell so far, but a
little problem appears.

The downloads are for members only, and therefor I
need to check if the user is logged in, I do this by
sessions and therefore I add a session_start() at the
start of my file. When I do this some headers are
added to the file, namely :

Set-Cookie: PHPSESSID=xxx; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache

Theese headers are not needed, and I dont want them
either, exept I cant seem to get rid of them since I
need the session_start() in the beginning of the file.

Sure, I could wish for a function unset_potensial_header(pragma);

I guess there are no way to remove theese unwanted headers?
Yesterday I had to give up another problem, but luckily I
found the answer here :  http://bugs.php.net/bug.php?id=33057

So to sum it up :
How can I remove the Cache-Control and Pragma headers?

And Im not looking for this answer :
  header('Pragma: ');
  header('Cache-control: ');

The headers are still sendt, exept they are empty, doesnt look
like a nice sollution for a production environment.

Kind regards,
Kim Steinhaug
- - - - - - - - -
www.steinhaug.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start(), Pragma and Cache-control headers

2005-08-22 Thread Kim Steinhaug \(php list\)
I solved the problem after a while, seems it had been
reacently debated in the bug pages within php, to remove
headers which are added by the session_start(); you can 
add the following :

ini_set('session.use_cookies', false);
session_cache_limiter('');

Kind regards,
Kim Steinhaug
- - - - - - - - -
www.steinhaug.com


- Original Message - 
From: Kim Steinhaug (php list) [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Monday, August 22, 2005 7:01 PM
Subject: [PHP] session_start(), Pragma and Cache-control headers


 Hello,
 
 I'm working on a downbload script which serves M3U
 files (Winamp playlist files) through a PHP file
 like this :
 
 somepath/download.m3u.php?id=2
 
 Then in the PHP script I generate the M3U file, and
 serve up the headers I want. Swell so far, but a
 little problem appears.
 
 The downloads are for members only, and therefor I
 need to check if the user is logged in, I do this by
 sessions and therefore I add a session_start() at the
 start of my file. When I do this some headers are
 added to the file, namely :
 
 Set-Cookie: PHPSESSID=xxx; path=/
 Expires: Thu, 19 Nov 1981 08:52:00 GMT
 Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
 pre-check=0
 Pragma: no-cache
 
 Theese headers are not needed, and I dont want them
 either, exept I cant seem to get rid of them since I
 need the session_start() in the beginning of the file.
 
 Sure, I could wish for a function unset_potensial_header(pragma);
 
 I guess there are no way to remove theese unwanted headers?
 Yesterday I had to give up another problem, but luckily I
 found the answer here :  http://bugs.php.net/bug.php?id=33057
 
 So to sum it up :
 How can I remove the Cache-Control and Pragma headers?
 
 And Im not looking for this answer :
   header('Pragma: ');
   header('Cache-control: ');
 
 The headers are still sendt, exept they are empty, doesnt look
 like a nice sollution for a production environment.
 
 Kind regards,
 Kim Steinhaug
 - - - - - - - - -
 www.steinhaug.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-27 Thread Lizet Peña de Sola
I'll try that, thanks a lot.


-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id


Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-27 Thread Lizet Peña de Sola

It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one...
Here I copy the logout.php code:
?
$_SESSION['validlogin']=; 
$_SESSION['username']=; 
$_SESSION['password']=; //destroy the sessions array 
$_SESSION = array(); 
//destroy the session
if(session_id()){
session_destroy(); 
}
?

And the code that runs when the user logs in:
?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){   
  session_start();
  
  $_SESSION['validlogin']=true;
  $_SESSION['username']=$username;
  $_SESSION['password']=$password;
}
...
?
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time?
Tia, Lizet

-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id


Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-27 Thread Lizet Peña de Sola
session_id($username);
session_start();
Solved the problem...
Thank you all for the replies...

-Original Message-
From: Lizet Peña de Sola [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 27, 2004 3:55 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id



It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one... Here I copy the logout.php code: ?
$_SESSION['validlogin']=; 
$_SESSION['username']=; 
$_SESSION['password']=; //destroy the sessions array 
$_SESSION = array(); 
//destroy the session
if(session_id()){
session_destroy(); 
}
?

And the code that runs when the user logs in:
?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){   
  session_start();
  
  $_SESSION['validlogin']=true;
  $_SESSION['username']=$username;
  $_SESSION['password']=$password;
}
...
?
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time? Tia, Lizet

-Original Message-
From: Reinhart Viane [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; [EMAIL PROTECTED]
Subject: RE: [PHP] @session_start generates a new session_id


Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-26 Thread Lizet Peña de Sola
Hello Greg,
Thanks for reply, I did try
ini_set ( session.auto_start, 1); and it set the session.auto_start to
On on my configuration, however the rest of the users on that server had
auto_start off.
This didn't solve the problem, should I try to access .htaccess? I presume
it will affect all the sites on that server, right?
The problem continues, I run the logout script each time the user leaves the
admin site:
?
$_SESSION['validlogin']=;
$_SESSION['username']=;
$_SESSION['password']=;
unset($_SESSION['validlogin']);
unset($_SESSION['username']);
unset($_SESSION['password']);
session_unset();
print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

And when the user tries to enter the admin panel again and log in, the
following script runs:
?
...
session_start();
  
$_SESSION['validlogin']=true;
$_SESSION['username']=$username;
$_SESSION['password']=$password;

?

However when the user logs out and the first script runs, if that user tries
to log in again with a different account, the session is started, but the
username and password variables take the first user's values, they're not
overriden.
Any idea?
Thanks a lot in advance.
Lizet

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 25, 2004 6:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] @session_start generates a new session_id


On Mon, 25 Oct 2004 15:59:18 -0400, Lizet Peña de Sola [EMAIL PROTECTED]
wrote:
 How can I set session_auto_start On, I have a similar problem and I 
 think it's because my web hosting has that feature off.

.htaccess

php_flag session.auto_start on


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-26 Thread Reinhart Viane
Instead of:
? $_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print(username=.$_SESSION['username']);
print(password=.$_SESSION['password']);

if(session_id()){
session_destroy();}
?

Try this:

//unregister the sessions
$_SESSION['validlogin']=; $_SESSION['username']=;
$_SESSION['password']=;
//destroy the sessions array
$_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] @session_start generates a new session_id

2004-10-25 Thread Mark-Walter
Hi Sadeq,

 Check your PHP config file. You may enable auto session start. I think
 this is the reasone of problem.

sorry for the delay and indeed your suggestion solves now my problem.

Thank's a lot :-)

-- 
Best Regards,

Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] @session_start generates a new session_id

2004-10-25 Thread Lizet Peña de Sola
How can I set session_auto_start On, I have a similar problem and I think
it's because my web hosting has that feature off.



-Original Message-
From: Sadeq Naqashzade [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 19, 2004 11:47 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] @session_start generates a new session_id


Hi,
Check your PHP config file. You may enable auto session start. I think this
is the reasone of problem.

Sadeq


On Tue, 19 Oct 2004 18:21:29 +0200, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi Matt,
 
   @session_start();
   session_name(userauth);
   $_SESSION['SESS_CUS'] = $user_id;
 
  I am not 100% sure what the problem is, but if you are trying to 
  change the session name to userauth, I think you need to do that 
  before session_start
 
 session_name() works ok so far.
 
 For example:
 ?
 @session_start;
 $session = session_id();  /* index.php */ $_SESSION['SESS_CUS'] == 
 $user_id; echo $session;
 ?
 
 OUTPUT in the browser:
 
 34f321149ee49d20e0e223f3020c1f77
 
 In the case a new page is loaded it changes to a new value:
 
 ?
 $session = session_id();  /* userauth.php */
 echo PHPSESSID: $session;
 echo SESSION:.$_SESSION['SESS_CUS'];
 ?
 
 OUTPUT in the browser:
 
 PHPSESSID: b65de73df8d327a4e15627ccfd14968d
 SESSION:
 
 A new request over http generates a new session and $_SESSION['XYZ'] 
 is not available anymore.
 
 --
 Best Regards,
 
 Mark
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
-
Yazd, 8917954894

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] @session_start generates a new session_id

2004-10-25 Thread Greg Donald
On Mon, 25 Oct 2004 15:59:18 -0400, Lizet Peña de Sola
[EMAIL PROTECTED] wrote:
 How can I set session_auto_start On, I have a similar problem and I think
 it's because my web hosting has that feature off.

.htaccess

php_flag session.auto_start on


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] @session_start generates a new session_id

2004-10-19 Thread Mark-Walter
Hi,

I made an update to Apache/1.3.31 (Unix) PHP/4.3.9 and
before this everythings works fine.

The problem is that a following page generates a new
session stored under the session.save_path and the
stored variable e.g. $_SESSION['SESS_CUS'] is not
valid anymore due the SID entry.

On both pages I use this to start:

@session_start();
session_name(userauth);
$_SESSION['SESS_CUS'] = $user_id;

to verify the $USER_ID in conjunction with the actual 
valid session value.

I tried already a form with a hidden field to overgive
the session which works fine in the former version:

form method=post action=\./MyFILE.php?USERNAME=$realnameUSER_ID=$user_id\
INPUT TYPE=\hidden\ NAME=\session_name();\ value=\session_id();\
INPUT TYPE=\submit\ VALUE=\Login for the board\   
/form

But this doesn't work anymore ...

The new LAMP system generates everytime after calling
@session_start(); a new session. Either on the same
page or a following one.

How can I prevent this behavior by using the PHP session 
management function ?

-- 
Best Regards,

Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] @session_start generates a new session_id

2004-10-19 Thread Matt M.
 @session_start();
 session_name(userauth);
 $_SESSION['SESS_CUS'] = $user_id;


I am not 100% sure what the problem is, but if you are trying to
change the session name to userauth, I think you need to do that
before session_start

http://us2.php.net/session_name

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] @session_start generates a new session_id

2004-10-19 Thread Mark-Walter
Hi Matt,

  @session_start();
  session_name(userauth);
  $_SESSION['SESS_CUS'] = $user_id;
 
 I am not 100% sure what the problem is, but if you are trying to
 change the session name to userauth, I think you need to do that
 before session_start

session_name() works ok so far.

For example:
?
@session_start;
$session = session_id();  /* index.php */
$_SESSION['SESS_CUS'] == $user_id;
echo $session; 
?

OUTPUT in the browser:

34f321149ee49d20e0e223f3020c1f77

In the case a new page is loaded it changes to a new value:

?
$session = session_id();  /* userauth.php */
echo PHPSESSID: $session;
echo SESSION:.$_SESSION['SESS_CUS'];
?

OUTPUT in the browser:

PHPSESSID: b65de73df8d327a4e15627ccfd14968d
SESSION:  

A new request over http generates a new session and 
$_SESSION['XYZ'] is not available anymore.

-- 
Best Regards,

Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] @session_start generates a new session_id

2004-10-19 Thread Sadeq Naqashzade
Hi,
Check your PHP config file. You may enable auto session start. I think
this is the reasone of problem.

Sadeq


On Tue, 19 Oct 2004 18:21:29 +0200, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi Matt,
 
   @session_start();
   session_name(userauth);
   $_SESSION['SESS_CUS'] = $user_id;
 
  I am not 100% sure what the problem is, but if you are trying to
  change the session name to userauth, I think you need to do that
  before session_start
 
 session_name() works ok so far.
 
 For example:
 ?
 @session_start;
 $session = session_id();  /* index.php */
 $_SESSION['SESS_CUS'] == $user_id;
 echo $session;
 ?
 
 OUTPUT in the browser:
 
 34f321149ee49d20e0e223f3020c1f77
 
 In the case a new page is loaded it changes to a new value:
 
 ?
 $session = session_id();  /* userauth.php */
 echo PHPSESSID: $session;
 echo SESSION:.$_SESSION['SESS_CUS'];
 ?
 
 OUTPUT in the browser:
 
 PHPSESSID: b65de73df8d327a4e15627ccfd14968d
 SESSION:
 
 A new request over http generates a new session and
 $_SESSION['XYZ'] is not available anymore.
 
 --
 Best Regards,
 
 Mark
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
-
Yazd, 8917954894

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session_Start Problem (Fatal Error)

2004-07-09 Thread webmaster
I'm using Mambo Open Source CMS to run a site I'm building, and seem to have a
problem logging into the Administration Tool.  It comes up with:

Fatal error: session_start(): Failed to initialize storage module. in
/home/hetbweb/public_html/administrator/index.php on line 64

I've looked at various things that could cause this, and finally contacted my
server support who said:
It's a PHP bug which they still havent fixed as of yet, as soon as the fix
becomes available we will update PHP.
It may be worth looking on the mambo forums as there may be a patch to resolve
this for your script.

Does anyone know about this, and if so, is there a fix or work around or
anything?

Cheers
Nunners

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() warnings

2004-06-14 Thread franciccio
Always call the function on the first line of your page.

Bye



Paoage [EMAIL PROTECTED] ha scritto nel messaggio
news:[EMAIL PROTECTED]
 Larry E . Ullman wrote:
  When I use session_start function, I receive the following warning
  messages:
 
  Warning: session_start(): Cannot send session cookie - headers already
  sent by (output started at
  /home/w4t3c101/public_html/ListClientInfo.php:2) in
  /home/w4t3c101/public_html/SessionControl.php on line 9
  Warning: session_start(): Cannot send session cache limiter - headers
  already sent (output started at
  /home/w4t3c101/public_html/ListClientInfo.php:2) in
  /home/w4t3c101/public_html/SessionControl.php on line 9
 
  Can anyone explain why it happens and how to solve the warnings.
  Thanks :)
 
 
  Something on or about line 2 of ListClientInfo.php is sending data to
  the Web browser. This could be HTML, plain text, or blank spaces. Get
  rid of that and you'll get rid of the warnings.
 
  Larry


 Thanks, I got it. I leave a line of space before I use include directive.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start() warnings

2004-06-12 Thread PaoAge
Hi, all:
When I use session_start function, I receive the following warning messages:
Warning: session_start(): Cannot send session cookie - headers already 
sent by (output started at 
/home/w4t3c101/public_html/ListClientInfo.php:2) in 
/home/w4t3c101/public_html/SessionControl.php on line 9
Warning: session_start(): Cannot send session cache limiter - headers 
already sent (output started at 
/home/w4t3c101/public_html/ListClientInfo.php:2) in 
/home/w4t3c101/public_html/SessionControl.php on line 9

Can anyone explain why it happens and how to solve the warnings. Thanks :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_start() warnings

2004-06-12 Thread Larry E . Ullman
When I use session_start function, I receive the following warning 
messages:

Warning: session_start(): Cannot send session cookie - headers already 
sent by (output started at 
/home/w4t3c101/public_html/ListClientInfo.php:2) in 
/home/w4t3c101/public_html/SessionControl.php on line 9
Warning: session_start(): Cannot send session cache limiter - headers 
already sent (output started at 
/home/w4t3c101/public_html/ListClientInfo.php:2) in 
/home/w4t3c101/public_html/SessionControl.php on line 9

Can anyone explain why it happens and how to solve the warnings. 
Thanks :)
Something on or about line 2 of ListClientInfo.php is sending data to 
the Web browser. This could be HTML, plain text, or blank spaces. Get 
rid of that and you'll get rid of the warnings.

Larry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_start() warnings

2004-06-12 Thread PaoAge
Larry E . Ullman wrote:
When I use session_start function, I receive the following warning 
messages:

Warning: session_start(): Cannot send session cookie - headers already 
sent by (output started at 
/home/w4t3c101/public_html/ListClientInfo.php:2) in 
/home/w4t3c101/public_html/SessionControl.php on line 9
Warning: session_start(): Cannot send session cache limiter - headers 
already sent (output started at 
/home/w4t3c101/public_html/ListClientInfo.php:2) in 
/home/w4t3c101/public_html/SessionControl.php on line 9

Can anyone explain why it happens and how to solve the warnings. 
Thanks :)

Something on or about line 2 of ListClientInfo.php is sending data to 
the Web browser. This could be HTML, plain text, or blank spaces. Get 
rid of that and you'll get rid of the warnings.

Larry

Thanks, I got it. I leave a line of space before I use include directive.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] session_start in php 4.3.6

2004-05-21 Thread Paul Godard
Hi

All my web sites suddenly stopped working after my ISP installed the newer php 4.3.6 
released.  The problem is when calling the session_start() function.  It seems that 
the warning message saying that the session has already started and that the function 
will be ignored makes the php script stop at this point although it is a warning.  
This worked perfectly in php 4.3.4.

What should I do to be compatible with php 4.3.6?
-- 

Kind regards, Paul.

Gondwana
[EMAIL PROTECTED]
http://www.gondwanastudio.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start in php 4.3.6

2004-05-21 Thread Michael R. Wayne
On Fri, May 21, 2004 at 10:01:56PM +0200, Paul Godard wrote:
 Hi
 
 All my web sites suddenly stopped working after my ISP installed the newer php 4.3.6 
 released.  The problem is when calling the session_start() function.  It seems that 
 the warning message saying that the session has already started and that the 
 function will be ignored makes the php script stop at this point although it is a 
 warning.  This worked perfectly in php 4.3.4.
 
 What should I do to be compatible with php 4.3.6?

This is because your ISP has likely set 
   session.auto_start = 1
in php.ini

Either have the ISP set it to 0 or remove all session_start calls
from your scripts to eliminate the warnings.

/\/\ \/\/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start in php 4.3.6

2004-05-21 Thread Bob Lockie
On 05/21/04 16:08 Michael R. Wayne spoke:
On Fri, May 21, 2004 at 10:01:56PM +0200, Paul Godard wrote:
Hi
All my web sites suddenly stopped working after my ISP installed the newer php 4.3.6 
released.  The problem is when calling the session_start() function.  It seems that 
the warning message saying that the session has already started and that the function 
will be ignored makes the php script stop at this point although it is a warning.  
This worked perfectly in php 4.3.4.
What should I do to be compatible with php 4.3.6?

This is because your ISP has likely set 
   session.auto_start = 1
in php.ini

Either have the ISP set it to 0 or remove all session_start calls
from your scripts to eliminate the warnings.
Would putting an '@' in front of all session_start calls hide the problem?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_start in php 4.3.6

2004-05-21 Thread Curt Zirzow
* Thus wrote Bob Lockie ([EMAIL PROTECTED]):
 On 05/21/04 16:08 Michael R. Wayne spoke:
 On Fri, May 21, 2004 at 10:01:56PM +0200, Paul Godard wrote:
 
 Hi
 
 All my web sites suddenly stopped working after my ISP installed the 
 newer php 4.3.6 released.  The problem is when calling the 
 session_start() function.  It seems that the warning message saying that 
 the session has already started and that the function will be ignored 
 makes the php script stop at this point although it is a warning.  This 
 worked perfectly in php 4.3.4.
 
 What should I do to be compatible with php 4.3.6?
 
 
 This is because your ISP has likely set 
session.auto_start = 1
 in php.ini
 
 Either have the ISP set it to 0 or remove all session_start calls
 from your scripts to eliminate the warnings.
 
 Would putting an '@' in front of all session_start calls hide the problem?

Hide? yeah... Good Idea? No

if (! session_id() ) session_start();

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] @session_start()?

2004-05-01 Thread Brandon Goodin
I noticed this notation in one of the PEAR packages @session_start()? What
is the purpose of the '@' sign?

 

Thanks

Brandon



[PHP] session_start

2004-02-24 Thread Urb LeJeune
I would appreciate some help to save my few remaining hairs.

I have an administrative program starting with

session_start()

It starts by asking for userid and password.

It's been working for over a year with no problems. Within the last couple of
day something strange has been happening. Frequently, but not always, at
the bottom of the output is the message:
Warning: Unknown(): The session id contains invalid characters, valid 
characters are only a-z, A-Z and 0-9 in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify 
that the current setting of session.save_path is correct (/tmp) in Unknown 
on line 0

when it re enters the program I get:

Warning: session_start(): The session id contains invalid characters, valid 
characters are only a-z, A-Z and 0-9 in 
/usr/local/include/eg-admin-index.inc on line 7

Taking a shot in the dark I put

  session_name();

before

session_start()

It seems to have fixed the problem but I have no idea why. Can anyone shed 
some light
on:
1. what caused the problem to start?
2. how session_name() is fixing the problem?

Thanks

Urb 

Re: [PHP] session_start() make netscape 4.7 reload page.

2003-12-14 Thread BAO RuiXian
Jonathan Zhang wrote:

test.php
--
?
session_start();
?
form
input type=text name=test
/form
For Win2kpro+netscape 4.7,all form data you enter in this page will lost
when resize the browser's window size, ns4.7 have reload this page when
resize the window.
But if you remove the session_start() from this page, the issue will not
exist.
 

I use Win2kpro+netscape 7.1, resizing the window can keep the input 
data. I don't have netscape 4.7 installed, so can not test it. Perhaps 
there is some bug in it. You may update Netscape to 7.1 for a lasy solution.

Best

Bao

Is there any solution for it?

thanks,
Jonathan Zhang
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_start() make netscape 4.7 reload page.

2003-12-14 Thread Marek Kilimajer
Jonathan Zhang wrote:
test.php
--
?
session_start();
?
form
input type=text name=test
/form
For Win2kpro+netscape 4.7,all form data you enter in this page will lost
when resize the browser's window size, ns4.7 have reload this page when
resize the window.
But if you remove the session_start() from this page, the issue will not
exist.
Is there any solution for it?

thanks,
Jonathan Zhang
Netscape 4.x has this annoying behavior, it tries to fetch a fresh copy 
whenever you resize window, view source code or print the page.

You might try to use session_cache_limiter() function to control the 
cache headers send, try private_no_expire first. Do not set it to public 
if the page contains private information.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_start() make netscape 4.7 reload page.

2003-12-14 Thread Jonathan Zhang
Marek,

Thank you very much.

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Jonathan Zhang wrote:
  test.php
  --
  ?
  session_start();
  ?
  form
  input type=text name=test
  /form
 
  For Win2kpro+netscape 4.7,all form data you enter in this page will lost
  when resize the browser's window size, ns4.7 have reload this page when
  resize the window.
  But if you remove the session_start() from this page, the issue will not
  exist.
 
  Is there any solution for it?
 
  thanks,
  Jonathan Zhang
 

 Netscape 4.x has this annoying behavior, it tries to fetch a fresh copy
 whenever you resize window, view source code or print the page.

 You might try to use session_cache_limiter() function to control the
 cache headers send, try private_no_expire first. Do not set it to public
 if the page contains private information.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start() make netscape 4.7 reload page.

2003-12-13 Thread Jonathan Zhang
test.php
--
?
session_start();
?
form
input type=text name=test
/form

For Win2kpro+netscape 4.7,all form data you enter in this page will lost
when resize the browser's window size, ns4.7 have reload this page when
resize the window.
But if you remove the session_start() from this page, the issue will not
exist.

Is there any solution for it?

thanks,
Jonathan Zhang

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session_start() problem

2003-10-01 Thread Jeff McKeon
Hey all, I'm working out of a book teaching myself PHP4 here and I've
got this code from a login web page...

[begin code]
session_start();
if(!isset($userid)) {
login_form();
exit;
}
else {
session_regisister(userid, userpassword);
if(!$username) {
session_unregister(userid);
session_unregister(userpassword);
echo Authorization failed.  . 
 You must enter a valid userid and password
combo.  .
 Click on teh following link to try
again.BR\n;
echo A HREF=\$PHP_SELF\login/ABR;
echo If you do not have login, please contact
Operations to obtain one.br\n;
exit;
}
else echo welcome, $username!;
}
[end code]

The page puts up a for with fields for username, password etc. nothing
crazy, but when I open the page I get the following error displayed
(before data is entered into the form and subitted).

[begin error]
PHP Warning: session_start():
open(/tmp\sess_d7d909aa6e85cf5489a50f6e42f03b12, O_RDWR) failed: No such
file or directory (2) in c:\inetpub\wwwroot\auth_user.php on line 54 PHP
Warning: Unknown(): open(/tmp\sess_d7d909aa6e85cf5489a50f6e42f03b12,
O_RDWR) failed: No such file or directory (2) in Unknown on line 0 PHP
Warning: Unknown(): Failed to write session data (files). Please verify
that the current setting of session.save_path is correct (/tmp) in
Unknown on line 0 
[end error]

Not sure what I did wrong except to think that PHP is trying to write
the session id file to a directory that doesn't exist /tmp.  This is
running on a MS IIS server.  If I'm correct in my assessment, where do I
set the default location for session data?

Thanks,

Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_start() problem

2003-10-01 Thread CPT John W. Holmes
From: Jeff McKeon [EMAIL PROTECTED]
[snip]
 where do I set the default location for session data?

session.save_path in php.ini

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_start() problem

2003-10-01 Thread Curt Zirzow
* Thus wrote Jeff McKeon ([EMAIL PROTECTED]):

Not related to your problem but:

   session_regisister(userid, userpassword);
spelling ~~~^^




Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread Marek Kilimajer
Sessions don't work on command line and that is how you run your script 
- from command line.

CF High wrote:
Hey Robert.

Indeed, hard to find the problem.

I don't believe it's a whitespace issue, or even a Headers sent issue,
despite the fact that I'm receiving that error.
Check it out:

test.php contains just one line: ?$text = `usr/local/bin/php
/path/to/my/php/test1.php`;?
test1.php, the file to be executed, contains just one line:
?session_start();?
There are no line breaks, spaces, etc.

Still get Headers already sent.

Pretty strange, right?

Correct me if I'm wrong, but I think the problem may be related to the fact
that when files are executed from the command line, php now looks for
include_paths, session_paths, etc. relative to the server root; not the site
root.
I can think of no other reason why include paths, starting sessions, and so
on, return errors from the command line but ork perfectly fine when run in a
browser.
Feel free to clue me in -- I know didly about shell access issues.

--Noah

Robert Cummings [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Sat, 2003-09-20 at 15:46, CF High wrote:

Hey all.

I'm running a script from the command-line php interpreter as follows:
(thanks to D. Souza for lead)
$text = `usr/local/bin/php /path/to/my/php/page.php`;

within the read file I want to enable sessions, so I session_start() at
the

top of the page:

?
session_start();
?
?
   code to execute here...
?
Regardless of how I mess around with placement of session_start(), I get
a

Headers already sent.

Why? Nothing has been output to the browser within the read file!
Furthermore, if I create a test page with just:
?$text = `usr/local/bin/php /path/to/my/php/page.php`;?

Still receive Headers already sent.

My eyes are completely fried -- anyone feel like saving my vision?
This often is difficult to detect when there's is implicit output
outside of the ? tag. Check the top of the included file or start php
script and see if there is any whitespace or newlines preceding the tag.
HTH,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
H,

Well, is there a way to pass params to file_to_be_executed in command line?

For example:

?
$my_param = 'my_include_path';
$text = `usr/local/bin/php /path/to/my/php/page.php`;
?

Somehow I need $my_param to be passed to page.php (the file to be processed
in command line).

Any ideas?

--Noah



Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Sessions don't work on command line and that is how you run your script
 - from command line.

 CF High wrote:
  Hey Robert.
 
  Indeed, hard to find the problem.
 
  I don't believe it's a whitespace issue, or even a Headers sent issue,
  despite the fact that I'm receiving that error.
 
  Check it out:
 
  test.php contains just one line: ?$text = `usr/local/bin/php
  /path/to/my/php/test1.php`;?
 
  test1.php, the file to be executed, contains just one line:
  ?session_start();?
 
  There are no line breaks, spaces, etc.
 
  Still get Headers already sent.
 
  Pretty strange, right?
 
  Correct me if I'm wrong, but I think the problem may be related to the
fact
  that when files are executed from the command line, php now looks for
  include_paths, session_paths, etc. relative to the server root; not the
site
  root.
 
  I can think of no other reason why include paths, starting sessions, and
so
  on, return errors from the command line but ork perfectly fine when run
in a
  browser.
 
  Feel free to clue me in -- I know didly about shell access issues.
 
  --Noah
 
 
  Robert Cummings [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 On Sat, 2003-09-20 at 15:46, CF High wrote:
 
 Hey all.
 
 I'm running a script from the command-line php interpreter as follows:
 (thanks to D. Souza for lead)
 
 $text = `usr/local/bin/php /path/to/my/php/page.php`;
 
 within the read file I want to enable sessions, so I session_start() at
 
  the
 
 top of the page:
 
 ?
 session_start();
 ?
 ?
 code to execute here...
 ?
 
 Regardless of how I mess around with placement of session_start(), I
get
 
  a
 
 Headers already sent.
 
 Why? Nothing has been output to the browser within the read file!
 Furthermore, if I create a test page with just:
 
 ?$text = `usr/local/bin/php /path/to/my/php/page.php`;?
 
 Still receive Headers already sent.
 
 My eyes are completely fried -- anyone feel like saving my vision?
 
 This often is difficult to detect when there's is implicit output
 outside of the ? tag. Check the top of the included file or start php
 script and see if there is any whitespace or newlines preceding the tag.
 
 HTH,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
Thank the heavens above

Actually, thank Ben, a poster from php.net manual.

Looks like environment variables are not passed to file when it is executed
from the command line.

A workaround is:

$inc_path = $_SERVER['DOCUMENT_ROOT'] . '/';
$remaddr = getenv(DOCUMENT_ROOT);
putenv(DOCUMENT_ROOT=$inc_path);

That does the trick for what I need done now; namely, being able to include
files within my command line executed files.

Still, there must be a way to pass params to command line executed
files..

--Noah



Cf High [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 H,

 Well, is there a way to pass params to file_to_be_executed in command
line?

 For example:

 ?
 $my_param = 'my_include_path';
 $text = `usr/local/bin/php /path/to/my/php/page.php`;
 ?

 Somehow I need $my_param to be passed to page.php (the file to be
processed
 in command line).

 Any ideas?

 --Noah



 Marek Kilimajer [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Sessions don't work on command line and that is how you run your script
  - from command line.
 
  CF High wrote:
   Hey Robert.
  
   Indeed, hard to find the problem.
  
   I don't believe it's a whitespace issue, or even a Headers sent
issue,
   despite the fact that I'm receiving that error.
  
   Check it out:
  
   test.php contains just one line: ?$text = `usr/local/bin/php
   /path/to/my/php/test1.php`;?
  
   test1.php, the file to be executed, contains just one line:
   ?session_start();?
  
   There are no line breaks, spaces, etc.
  
   Still get Headers already sent.
  
   Pretty strange, right?
  
   Correct me if I'm wrong, but I think the problem may be related to the
 fact
   that when files are executed from the command line, php now looks for
   include_paths, session_paths, etc. relative to the server root; not
the
 site
   root.
  
   I can think of no other reason why include paths, starting sessions,
and
 so
   on, return errors from the command line but ork perfectly fine when
run
 in a
   browser.
  
   Feel free to clue me in -- I know didly about shell access issues.
  
   --Noah
  
  
   Robert Cummings [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
  
  On Sat, 2003-09-20 at 15:46, CF High wrote:
  
  Hey all.
  
  I'm running a script from the command-line php interpreter as
follows:
  (thanks to D. Souza for lead)
  
  $text = `usr/local/bin/php /path/to/my/php/page.php`;
  
  within the read file I want to enable sessions, so I session_start()
at
  
   the
  
  top of the page:
  
  ?
  session_start();
  ?
  ?
  code to execute here...
  ?
  
  Regardless of how I mess around with placement of session_start(), I
 get
  
   a
  
  Headers already sent.
  
  Why? Nothing has been output to the browser within the read file!
  Furthermore, if I create a test page with just:
  
  ?$text = `usr/local/bin/php /path/to/my/php/page.php`;?
  
  Still receive Headers already sent.
  
  My eyes are completely fried -- anyone feel like saving my vision?
  
  This often is difficult to detect when there's is implicit output
  outside of the ? tag. Check the top of the included file or start php
  script and see if there is any whitespace or newlines preceding the
tag.
  
  HTH,
  Rob.
  --
  ..
  | InterJinn Application Framework - http://www.interjinn.com |
  ::
  | An application and templating framework for PHP. Boasting  |
  | a powerful, scalable system for accessing system services  |
  | such as forms, properties, sessions, and caches. InterJinn |
  | also provides an extremely flexible architecture for   |
  | creating re-usable components quickly and easily.  |
  `'
  
  

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread Rasmus Lerdorf
On Sun, 21 Sep 2003, CF High wrote:
 Well, is there a way to pass params to file_to_be_executed in command line?
 
 For example:
 
 ?
 $my_param = 'my_include_path';
 $text = `usr/local/bin/php /path/to/my/php/page.php`;
 ?
 
 Somehow I need $my_param to be passed to page.php (the file to be processed
 in command line).
 
 Any ideas?

Just put them after the filename and grab them out of your $argv array.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] session_start() || shell access problem......

2003-09-21 Thread Tom Rogers
Hi,

Monday, September 22, 2003, 2:13:57 AM, you wrote:
CH H,

CH Well, is there a way to pass params to file_to_be_executed in command line?

CH For example:

CH ?
CH $my_param = 'my_include_path';
CH $text = `usr/local/bin/php /path/to/my/php/page.php`;
?

CH Somehow I need $my_param to be passed to page.php (the file to be processed
CH in command line).

CH Any ideas?

CH --Noah



CH Marek Kilimajer [EMAIL PROTECTED] wrote in message
CH news:[EMAIL PROTECTED]
 Sessions don't work on command line and that is how you run your script
 - from command line.

 CF High wrote:
  Hey Robert.
 
  Indeed, hard to find the problem.
 
  I don't believe it's a whitespace issue, or even a Headers sent issue,
  despite the fact that I'm receiving that error.
 
  Check it out:
 
  test.php contains just one line: ?$text = `usr/local/bin/php
  /path/to/my/php/test1.php`;?
 
  test1.php, the file to be executed, contains just one line:
  ?session_start();?
 
  There are no line breaks, spaces, etc.
 
  Still get Headers already sent.
 
  Pretty strange, right?
 
  Correct me if I'm wrong, but I think the problem may be related to the
CH fact
  that when files are executed from the command line, php now looks for
  include_paths, session_paths, etc. relative to the server root; not the
CH site
  root.
 
  I can think of no other reason why include paths, starting sessions, and
CH so
  on, return errors from the command line but ork perfectly fine when run
CH in a
  browser.
 
  Feel free to clue me in -- I know didly about shell access issues.
 
  --Noah
 
 
  Robert Cummings [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 On Sat, 2003-09-20 at 15:46, CF High wrote:
 
 Hey all.
 
 I'm running a script from the command-line php interpreter as follows:
 (thanks to D. Souza for lead)
 
 $text = `usr/local/bin/php /path/to/my/php/page.php`;
 
 within the read file I want to enable sessions, so I session_start() at
 
  the
 
 top of the page:
 
 ?
 session_start();
 ?
 ?
 code to execute here...
 ?
 
 Regardless of how I mess around with placement of session_start(), I
CH get
 
  a
 
 Headers already sent.
 
 Why? Nothing has been output to the browser within the read file!
 Furthermore, if I create a test page with just:
 
 ?$text = `usr/local/bin/php /path/to/my/php/page.php`;?
 
 Still receive Headers already sent.
 
 My eyes are completely fried -- anyone feel like saving my vision?
 
 This often is difficult to detect when there's is implicit output
 outside of the ? tag. Check the top of the included file or start php
 script and see if there is any whitespace or newlines preceding the tag.
 
 HTH,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 
 


Try this

?php
$args = 'hello world';
$text = `/usr/bin/php /usr/local/apache/htdocs/in.php $args`;
echo $text;
?

in.php contains:

?php
echo 'pre';
phpinfo(32);
echo '/pre';
echo $_SERVER['argv'][1];
?

That should do what you want if I understand the problem :)

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] session_start() || shell access problem......

2003-09-21 Thread CF High
Finally!

Thanks Tom  Rasmus for pointing me in the right direction.

God, two days of bleary eyed searching -- enough is enough.  Thank you guys
for helping out a newbie.

--Noah


Tom Rogers [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Monday, September 22, 2003, 2:13:57 AM, you wrote:
 CH H,

 CH Well, is there a way to pass params to file_to_be_executed in command
line?

 CH For example:

 CH ?
 CH $my_param = 'my_include_path';
 CH $text = `usr/local/bin/php /path/to/my/php/page.php`;
 ?

 CH Somehow I need $my_param to be passed to page.php (the file to be
processed
 CH in command line).

 CH Any ideas?

 CH --Noah



 CH Marek Kilimajer [EMAIL PROTECTED] wrote in message
 CH news:[EMAIL PROTECTED]
  Sessions don't work on command line and that is how you run your script
  - from command line.
 
  CF High wrote:
   Hey Robert.
  
   Indeed, hard to find the problem.
  
   I don't believe it's a whitespace issue, or even a Headers sent
issue,
   despite the fact that I'm receiving that error.
  
   Check it out:
  
   test.php contains just one line: ?$text = `usr/local/bin/php
   /path/to/my/php/test1.php`;?
  
   test1.php, the file to be executed, contains just one line:
   ?session_start();?
  
   There are no line breaks, spaces, etc.
  
   Still get Headers already sent.
  
   Pretty strange, right?
  
   Correct me if I'm wrong, but I think the problem may be related to
the
 CH fact
   that when files are executed from the command line, php now looks for
   include_paths, session_paths, etc. relative to the server root; not
the
 CH site
   root.
  
   I can think of no other reason why include paths, starting sessions,
and
 CH so
   on, return errors from the command line but ork perfectly fine when
run
 CH in a
   browser.
  
   Feel free to clue me in -- I know didly about shell access issues.
  
   --Noah
  
  
   Robert Cummings [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
  
  On Sat, 2003-09-20 at 15:46, CF High wrote:
  
  Hey all.
  
  I'm running a script from the command-line php interpreter as
follows:
  (thanks to D. Souza for lead)
  
  $text = `usr/local/bin/php /path/to/my/php/page.php`;
  
  within the read file I want to enable sessions, so I session_start()
at
  
   the
  
  top of the page:
  
  ?
  session_start();
  ?
  ?
  code to execute here...
  ?
  
  Regardless of how I mess around with placement of session_start(), I
 CH get
  
   a
  
  Headers already sent.
  
  Why? Nothing has been output to the browser within the read file!
  Furthermore, if I create a test page with just:
  
  ?$text = `usr/local/bin/php /path/to/my/php/page.php`;?
  
  Still receive Headers already sent.
  
  My eyes are completely fried -- anyone feel like saving my vision?
  
  This often is difficult to detect when there's is implicit output
  outside of the ? tag. Check the top of the included file or start
php
  script and see if there is any whitespace or newlines preceding the
tag.
  
  HTH,
  Rob.
  --
  ..
  | InterJinn Application Framework - http://www.interjinn.com |
  ::
  | An application and templating framework for PHP. Boasting  |
  | a powerful, scalable system for accessing system services  |
  | such as forms, properties, sessions, and caches. InterJinn |
  | also provides an extremely flexible architecture for   |
  | creating re-usable components quickly and easily.  |
  `'
  
  


 Try this

 ?php
 $args = 'hello world';
 $text = `/usr/bin/php /usr/local/apache/htdocs/in.php $args`;
 echo $text;
 ?

 in.php contains:

 ?php
 echo 'pre';
 phpinfo(32);
 echo '/pre';
 echo $_SERVER['argv'][1];
 ?

 That should do what you want if I understand the problem :)

 --
 regards,
 Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start() || shell access problem......

2003-09-20 Thread CF High
Hey all.

I'm running a script from the command-line php interpreter as follows:
(thanks to D. Souza for lead)

$text = `usr/local/bin/php /path/to/my/php/page.php`;

within the read file I want to enable sessions, so I session_start() at the
top of the page:

?
session_start();
?
?
code to execute here...
?

Regardless of how I mess around with placement of session_start(), I get a
Headers already sent.

Why? Nothing has been output to the browser within the read file!
Furthermore, if I create a test page with just:

?$text = `usr/local/bin/php /path/to/my/php/page.php`;?

Still receive Headers already sent.

My eyes are completely fried -- anyone feel like saving my vision?

--Noah

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() || shell access problem......

2003-09-20 Thread Robert Cummings
On Sat, 2003-09-20 at 15:46, CF High wrote:
 Hey all.
 
 I'm running a script from the command-line php interpreter as follows:
 (thanks to D. Souza for lead)
 
 $text = `usr/local/bin/php /path/to/my/php/page.php`;
 
 within the read file I want to enable sessions, so I session_start() at the
 top of the page:
 
 ?
 session_start();
 ?
 ?
 code to execute here...
 ?
 
 Regardless of how I mess around with placement of session_start(), I get a
 Headers already sent.
 
 Why? Nothing has been output to the browser within the read file!
 Furthermore, if I create a test page with just:
 
 ?$text = `usr/local/bin/php /path/to/my/php/page.php`;?
 
 Still receive Headers already sent.
 
 My eyes are completely fried -- anyone feel like saving my vision?

This often is difficult to detect when there's is implicit output
outside of the ? tag. Check the top of the included file or start php
script and see if there is any whitespace or newlines preceding the tag.

HTH,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start() || shell access problem......

2003-09-20 Thread CF High
Hey Robert.

Indeed, hard to find the problem.

I don't believe it's a whitespace issue, or even a Headers sent issue,
despite the fact that I'm receiving that error.

Check it out:

test.php contains just one line: ?$text = `usr/local/bin/php
/path/to/my/php/test1.php`;?

test1.php, the file to be executed, contains just one line:
?session_start();?

There are no line breaks, spaces, etc.

Still get Headers already sent.

Pretty strange, right?

Correct me if I'm wrong, but I think the problem may be related to the fact
that when files are executed from the command line, php now looks for
include_paths, session_paths, etc. relative to the server root; not the site
root.

I can think of no other reason why include paths, starting sessions, and so
on, return errors from the command line but ork perfectly fine when run in a
browser.

Feel free to clue me in -- I know didly about shell access issues.

--Noah


Robert Cummings [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Sat, 2003-09-20 at 15:46, CF High wrote:
  Hey all.
 
  I'm running a script from the command-line php interpreter as follows:
  (thanks to D. Souza for lead)
 
  $text = `usr/local/bin/php /path/to/my/php/page.php`;
 
  within the read file I want to enable sessions, so I session_start() at
the
  top of the page:
 
  ?
  session_start();
  ?
  ?
  code to execute here...
  ?
 
  Regardless of how I mess around with placement of session_start(), I get
a
  Headers already sent.
 
  Why? Nothing has been output to the browser within the read file!
  Furthermore, if I create a test page with just:
 
  ?$text = `usr/local/bin/php /path/to/my/php/page.php`;?
 
  Still receive Headers already sent.
 
  My eyes are completely fried -- anyone feel like saving my vision?

 This often is difficult to detect when there's is implicit output
 outside of the ? tag. Check the top of the included file or start php
 script and see if there is any whitespace or newlines preceding the tag.

 HTH,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_start() corrupt HTML output with IE

2003-09-04 Thread Christophe Chisogne
hecchan wrote:
Using IE 6 (XP) i can't see the source generated for PHP even the page 
works properly (It doesn't happend with Mozilla or Opera).
The View source in IE 5 and 6 is buggy : it doesnt work as soon as
there are too many files in the Temp Internetfiles folder. sic.
Solution is of course emptying IE cache... or switching to mozilla ;-)
See M$ Knowledge base article Q306907

--
Christophe Chisogne
Developper, Publicityweb sprl
http://www.publicityweb.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Session_start() corrupt HTML output with IE

2003-09-04 Thread Viraj Kalinga Abayarathna
Thank you Curt for the explanation.

Viraj

Curt Zirzow wrote:
 
 * Thus wrote Viraj Kalinga Abayarathna ([EMAIL PROTECTED]):
 
 header(Cache-control: private);
 
  p.s.
  and also if there is any one wo knows what exactly this header line
  means,
  please post a brief decription. thanks.
 
 private means that only the intended person that is getting this
 file is able to cache it.  So if you're going through a proxy that
 proxy must not cache that file.
 
 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session_start() corrupt HTML output with IE

2003-09-03 Thread hecchan
Hi,
Using IE 6 (XP) i can't see the source generated for PHP even the page 
works properly (It doesn't happend with Mozilla or Opera).

If i comment out the line:
session_start()
This behaviour stops.
Any idea what's going on?
Thanks

hecchan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Session_start() corrupt HTML output with IE

2003-09-03 Thread Viraj Kalinga Abayarathna
Hi hecchan,
I don't have a crear idea on what your problem is, but i have read
an article on phpfreak.com, it says to work the sessioned PHP scripts
correctly with IE6 you have to insert..

 header(Cache-control: private);

immediatly after starting the session.

try this.

Viraj

p.s.
and also if there is any one wo knows what exactly this header line
means,
please post a brief decription. thanks.



hecchan wrote:
 
 Hi,
 Using IE 6 (XP) i can't see the source generated for PHP even the page
 works properly (It doesn't happend with Mozilla or Opera).
 
 If i comment out the line:
 session_start()
 This behaviour stops.
 Any idea what's going on?
 
 Thanks
 
 hecchan
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_start() corrupt HTML output with IE

2003-09-03 Thread Curt Zirzow
* Thus wrote Viraj Kalinga Abayarathna ([EMAIL PROTECTED]):
 
header(Cache-control: private);
 
 p.s.
 and also if there is any one wo knows what exactly this header line
 means,
 please post a brief decription. thanks.

private means that only the intended person that is getting this
file is able to cache it.  So if you're going through a proxy that
proxy must not cache that file.



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session_start() corrupt HTML output with IE

2003-09-03 Thread Curt Zirzow
* Thus wrote hecchan ([EMAIL PROTECTED]):
 Hi,
 Using IE 6 (XP) i can't see the source generated for PHP even the page 
 works properly (It doesn't happend with Mozilla or Opera).
 
 If i comment out the line:
 session_start()
 This behaviour stops.
 Any idea what's going on?

What is your session.cache_limiter ini setting?

private, nocache, public?



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start() : read failed: Value too large for defined datatype (75) ...

2003-08-28 Thread Richard NAGY
Hello,

I'm using an apache server 1.3.28 on RedHat GNU/Linux 6.2 with php
4.3.1. Before, I was using apache 1.3.14 with php 4.0.6. Since I have
upgraded, I have problems with session_start. I have tried to set
register_globals either to on or to off but it has no effect on this
problem.

Example :

Warning: session_start() [function.session-start]: read failed: Value
too large for defined data type (75) in
/var/www/htdocs/site/ssl/accueil/connexion.php on line 28

(Before upgrading, it was running without any problem.)


How can I solve this problem? 
Thanks in advance.


-- 
***
Richard NAGY
Nameshield
46, rue Jean BODIN
F-49000 Angers
Tél : +33 2 41 18 28 28
***

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session_start questions.

2003-06-06 Thread Daniel J. Rychlik
Questions, Questions, Questions.

Where do I start in understanding how this function works.  Ive read the document 
multiple times, and I am having a bit of trouble figuring out how this function works. 
 I know that you can take session data and hold it somewhere for a user and use that 
data throughout php web pages.  I am wandering,  where is this data held and how to do 
you reference it ?  Is their a more detailed explanantion of session's ?  If their is 
not, once I get this, I will write one for people like me.  You know,  Sessions 
for Dummies  ;o)  

Never the less, how do you set a session name for a specific user and hold that data 
for processing?  Is this magic from somewhere or do you specifically name a session 
for every user ?  What about security implications ?  I will be running all my forms 
through secured protocol so hopefully their wont be any hijacking going on...

Sorry for being a pain. 

RE: [PHP] session_start

2003-02-26 Thread Mr Percival

 [snip]
 Not to be nosey or anything but usually session data will always be saved
 or not. How come one would want to check to see if is was or not.
 [snip] 

Maybe I am on the wrong track but the other day I got a disk full error when I was 
sending some mail... at the same time while my website was working, it wasnt saving 
session data, so users were getting sent back to the login page instead of going on to 
use the site.

What I was hoping to do was to be able to give a error message if the server was 
having this problem, but in order to do that I was needing a way of knowing if it was 
because the session_start failed or users who didnt have cookies turned on.

I probably just need to get a new host since these disk full errors happen regularly. 
:(

Mr P.

-- 
__
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start

2003-02-26 Thread Justin French
Yeah, get a new host :)

J


on 27/02/03 11:36 AM, Mr Percival ([EMAIL PROTECTED]) wrote:

 
 [snip]
 Not to be nosey or anything but usually session data will always be saved
 or not. How come one would want to check to see if is was or not.
 [snip]
 
 Maybe I am on the wrong track but the other day I got a disk full error when
 I was sending some mail... at the same time while my website was working, it
 wasnt saving session data, so users were getting sent back to the login page
 instead of going on to use the site.
 
 What I was hoping to do was to be able to give a error message if the server
 was having this problem, but in order to do that I was needing a way of
 knowing if it was because the session_start failed or users who didnt have
 cookies turned on.
 
 I probably just need to get a new host since these disk full errors happen
 regularly. :(
 
 Mr P.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] session_start

2003-02-26 Thread Ernest E Vogelsinger
At 01:36 27.02.2003, Mr Percival said:
[snip]
What I was hoping to do was to be able to give a error message if the server 
was having this problem, but in order to do that I was needing a way of 
knowing if it was because the session_start failed or users who didnt have 
cookies turned on.

I probably just need to get a new host since these disk full errors happen 
regularly. :(
[snip] 

session_start() cannot fail - the failure happens after the end of your
influence.

Ask these guys at your webhost to move /tmp to another partition, or
_at_least_ to have session.save_path point to a partition that doesn't get
exhausted too quickly.

God. What do these webhosts think...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] session_start

2003-02-26 Thread John W. Holmes
 At 01:36 27.02.2003, Mr Percival said:
 [snip]
 What I was hoping to do was to be able to give a error message if the
 server
 was having this problem, but in order to do that I was needing a way
of
 knowing if it was because the session_start failed or users who didnt
 have
 cookies turned on.
 
 I probably just need to get a new host since these disk full errors
 happen
 regularly. :(
 [snip]
 
 session_start() cannot fail - the failure happens after the end of
your
 influence.
 
 Ask these guys at your webhost to move /tmp to another partition, or
 _at_least_ to have session.save_path point to a partition that doesn't
get
 exhausted too quickly.

Or use session_save_path() in your script to use a directory of your
own. Make sure you implement your own cleanup, though. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start

2003-02-24 Thread Ernest E Vogelsinger
At 05:52 24.02.2003, Mr Percival said:
[snip]
According to the PHP manual session_start always returns true.

Ther are times (like when there is a disk full error on the server) that the 
sesison_start will fail because its unable to write the session tmp file.

So shouldnt session_start be able to return false if the file write fails?

Or does it return false but the manual doesnt say so?
[snip] 

session_start() just prepares for session use:
- check for an existing session ID (cookie or request parameter
- if found, retrieve stored session data
- else generate new session key
- check garbage collection (gc_probability)

There's nothing that it does to prepare to write the session file, this is
done when your script exits.

BTW, having a look at the implementation in ext/session/session.c, the
function is declared returning void:
 PHPAPI void php_session_start(TSRMLS_D)

The actual return value being stored in register AX (at least on Intel
platforms) it is most unlikely that ax contains a zero value. The last
statements at function end are:

if (PS(mod_data)  PS(gc_probability)  0) {
int nrdels = -1;
nrand = (int) (100.0*php_combined_lcg(TSRMLS_C));
if (nrand  PS(gc_probability)) {
PS(mod)-gc(PS(mod_data), PS(gc_maxlifetime), nrdels TSRMLS_CC);
}
}

PS(mod_data): returns a pointer to internal data structures, not zero.
PS(gc_probability): usually 1.
nrand: seldom zero value.
Result: Will return false if (and only if) the garbage collector routine
(gc) returns false.

But anyway this has only academic value since php_session_start() is
declared to return void - this should be stated correctly in the manual IMHO.


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session_start

2003-02-24 Thread Mr Percival
So how do I check if the session write failed?

I thought perhaps

if(session_id() == ){
echo error;
}
but if all session_start does is basically assign a session ID then 
session_id will never be empty even when the write fails.

Thanks! :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >