RE: [PHP-DB] IIS, PHP, and session data
It turns out that the real problem was problem 1) I am not personally in control of our web server. I forwarded some of the posted messages to our IT department and they decided to change what they were telling me. They actually had register globals turned off not on. I changed my code to use the session array and it works beautifully now. Thank you all for your advice! - Matthew -Original Message- From: Simon Rees [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 25, 2005 4:25 PM To: php-db@lists.php.net Cc: Perry, Matthew (Fire Marshal's Office) Subject: Re: [PHP-DB] IIS, PHP, and session data On Tuesday 25 January 2005 20:20, Perry, Matthew (Fire Marshal's Office) wrote: I am having trouble with my session data on Microsoft IIS. Here is a little background of the problem: 1) I am not personally in control of our web server. Our IT department manages it. oh dear! ;-) They have IIS running on their sever and use MS SQL Server, but they have allowed me to use PHP instead of ASP. 2) I have Apache running on a local web server in our office (not the IT department). It accesses the SQL Server database remotely. I I can't comment on the use of register_globals or session_register as I always use the $_SESSION array but I do use PHP on IIS... Something that you might like to check is that the directory specified by: session.save_path in the IIS server's php.ini is a directory writable by the user that IIS masquerades. The default value for this is: c:\php\sessiondata which if your sysadmin installed php as Administrator will not be writable by the IIS user (normally IUSR_hostname). Either get the sysadmin to specify ( create) another dir that is writable by IIS or change the permissions on c:\php\sessiondata Assuming you're running Apache on a Linux (and probably other un*x) distribution you will find that the session.save_path variable is set to /tmp which is usually world writable. I think if you posted the exact error message it would tell me if this was happening to you or not... hth, Simon -- ~~ Simon Rees | [EMAIL PROTECTED] | ORA-03113: end-of-file on communication channel ~~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IIS, PHP, and session data
I am having trouble with my session data on Microsoft IIS. Here is a little background of the problem: 1) I am not personally in control of our web server. Our IT department manages it. They have IIS running on their sever and use MS SQL Server, but they have allowed me to use PHP instead of ASP. 2) I have Apache running on a local web server in our office (not the IT department). It accesses the SQL Server database remotely. I have register_global turned OFF and use the following code on each page: session_start(); session_register('logged_in'); session_register('username'); etc... Everything works PERFECTLY on my local system. 3) I have ported all of my code to the IIS server location. It accesses the database correctly but displays an error message when I try to use the session data. It does NOT post messages that the session could not be started (which is the normal sign of session data not being allowed). The message says the variable does not exist. It is as if the session is started but the variables aren't being saved. The question I have is: What concerns should I have with PHP sessions when I move from Apache to IIS? I do NOT need to know how to set up IIS to allow session data correctly (that's the job of our IT department). If this sounds like something our IT department has set up wrong, please do not feel compelled to answer this question. I just would appreciate some advice on what I may need to change in my own code so that it works with IIS instead of Apache. Thank you for your time, Matthew Perry
Re: [PHP-DB] IIS, PHP, and session data
Perry, Matthew (Fire Marshal's Office) wrote: I am having trouble with my session data on Microsoft IIS. Here is a little background of the problem: 1) I am not personally in control of our web server. Our IT department manages it. They have IIS running on their sever and use MS SQL Server, but they have allowed me to use PHP instead of ASP. 2) I have Apache running on a local web server in our office (not the IT department). It accesses the SQL Server database remotely. I have register_global turned OFF and use the following code on each page: session_start(); session_register('logged_in'); session_register('username'); have you tried using the $_SESSION superglobal instead? you dont state the versions of php btw. ... Thank you for your time, Matthew Perry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IIS, PHP, and session data
Perry, Matthew (Fire Marshal's Office) wrote: I am having trouble with my session data on Microsoft IIS. [snip] 2) I have Apache running on a local web server in our office (not the IT department). It accesses the SQL Server database remotely. I have register_global turned OFF and use the following code on each page: session_start(); session_register('logged_in'); session_register('username'); etc... Everything works PERFECTLY on my local system. 3) I have ported all of my code to the IIS server location. It accesses the database correctly but displays an error message when I try to use the session data. It does NOT post messages that the session could not be started (which is the normal sign of session data not being allowed). The message says the variable does not exist. It is as if the session is started but the variables aren't being saved. unless there is something I'm missing, register_globals isn't off on your development machine, otherwise that code isn't going to work. If there is additional code - e.g., you assigning those values something, then maybe I'm wrong. It sure looks like your problem *is* register_globals being off, and that it's actually on in your testbed and you're mistaken. Someone with more IIS experience - please feel free to chime in. It could just be some horrible common problem. Cheers, -- - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IIS, PHP, and session data
Perry, Matthew (Fire Marshal's Office) wrote: 2) I have Apache running on a local web server in our office (not the IT department). It accesses the SQL Server database remotely. I have register_global turned OFF and use the following code on each page: session_start(); session_register('logged_in'); session_register('username'); Are you using an old version of PHP? Don't use session_register(). Use session_start() and then reference everything with the $_SESSION array. In your code above, $logged_in and $username will not exist with register_globals off. That may be leading to the errors you see later. The question I have is: What concerns should I have with PHP sessions when I move from Apache to IIS? None if sessions are set up correctly on each machine and you're using the same version of PHP at the same error reporting level. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IIS, PHP, and session data
On Tuesday 25 January 2005 20:20, Perry, Matthew (Fire Marshal's Office) wrote: I am having trouble with my session data on Microsoft IIS. Here is a little background of the problem: 1) I am not personally in control of our web server. Our IT department manages it. oh dear! ;-) They have IIS running on their sever and use MS SQL Server, but they have allowed me to use PHP instead of ASP. 2) I have Apache running on a local web server in our office (not the IT department). It accesses the SQL Server database remotely. I I can't comment on the use of register_globals or session_register as I always use the $_SESSION array but I do use PHP on IIS... Something that you might like to check is that the directory specified by: session.save_path in the IIS server's php.ini is a directory writable by the user that IIS masquerades. The default value for this is: c:\php\sessiondata which if your sysadmin installed php as Administrator will not be writable by the IIS user (normally IUSR_hostname). Either get the sysadmin to specify ( create) another dir that is writable by IIS or change the permissions on c:\php\sessiondata Assuming you're running Apache on a Linux (and probably other un*x) distribution you will find that the session.save_path variable is set to /tmp which is usually world writable. I think if you posted the exact error message it would tell me if this was happening to you or not... hth, Simon -- ~~ Simon Rees | [EMAIL PROTECTED] | ORA-03113: end-of-file on communication channel ~~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php