Hi. Im very new to php, and I have a problem here that I cant find the
solution for. I have problems with session variables, I want some
variables to maintain their value between different php script that is
being called. I have read the online manual, and here is an example from
it that doesnt work for me, it illustrates very well my problem.
File 1, index.php
<?php
// index.php
session_start() ;
echo '<br />Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php ">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
?>
File 2, page2.php
<?php
// page2.php
session_start() ;
echo '<br />Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="index.php ">page 1</a>';
?>
I get no output, except the date which shows 1970 bla bla
I have apache 2.0.48, PHP 4.3.3 running on a Redhat 9.0 box. I have not
touched the register_global s in php.ini, it's Off. What can be the problem
here ? Any help would be much appreciated, I'm stuck....
Thanx
/ZoombyWoof 18 8323
ZoombyWoof wrote:
[...] I get no output, except the date which shows 1970 bla bla
I have apache 2.0.48, PHP 4.3.3 running on a Redhat 9.0 box. I have not touched the register_global s in php.ini, it's Off. What can be the problem here ? Any help would be much appreciated, I'm stuck....
What do you have for "session.save_p ath" in php.ini?
Does the webserver have write-access to that directory?
--
I have a spam filter working.
To mail me include "urkxvq" (with or without the quotes)
in the subject line, or your mail will be ruthlessly discarded.
On Tue, 04 Nov 2003 15:32:14 +0000, Pedro wrote: ZoombyWoof wrote: [...] I get no output, except the date which shows 1970 bla bla
I have apache 2.0.48, PHP 4.3.3 running on a Redhat 9.0 box. I have not touched the register_global s in php.ini, it's Off. What can be the problem here ? Any help would be much appreciated, I'm stuck....
What do you have for "session.save_p ath" in php.ini? Does the webserver have write- permissions are
rwxrwxrwxt owned by root, so that shouldnt be a problem, or ?
/ZW
ZoombyWoof <zo************ **@thishotmail. com> wrote: Hi. Im very new to php, and I have a problem here that I cant find the solution for. I have problems with session variables, I want some variables to maintain their value between different php script that is being called. I have read the online manual, and here is an example from it that doesnt work for me, it illustrates very well my problem.
// Or maybe pass along the session id, if needed echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
The above will only work if you set session.use_tra ns_sid in php.ini to 1.
Furthermore cookies must be accepted by your browser in order to work.
Alternatively you could use:
echo '<br /><a href="page2.php ?'.session_name ().'='.session_ id().'">page
2</a>';
Check the session cookie on page 2 with session_get_coo kie_params() .. if
that's empty, the cookie hasn't been set. http://uk.php.net/manual/en/function...kie-params.php
HTH;
JOn
--
Begathon, n.:
A multi-day event on public television, used to raise money so
you won't have to watch commercials.
On Tue, 04 Nov 2003 15:35:08 +0000, Jon Kraft wrote: ZoombyWoof <zo************ **@thishotmail. com> wrote:
Hi. Im very new to php, and I have a problem here that I cant find the solution for. I have problems with session variables, I want some variables to maintain their value between different php script that is being called. I have read the online manual, and here is an example from it that doesnt work for me, it illustrates very well my problem.
// Or maybe pass along the session id, if needed echo '<br /><a href="page2.php ?' . SID . '">page 2</a>';
The above will only work if you set session.use_tra ns_sid in php.ini to 1. Furthermore cookies must be accepted by your browser in order to work.
Alternatively you could use:
echo '<br /><a href="page2.php ?'.session_name ().'='.session_ id().'">page 2</a>';
Check the session cookie on page 2 with session_get_coo kie_params() .. if that's empty, the cookie hasn't been set.
http://uk.php.net/manual/en/function...kie-params.php
HTH; JOn
I have tried all of what you suggested above, setting use_trans_sid to 1
didnt help. I used the link with session_name=se ssion_id, didnt help. I
have changed session.save_pa th to /usr/local/apache2/sessions, apache owns
that directory, apache is the user who runs the server, but nothing goes
in that directory. I have checked the cookie_params, and it doesnt contain
anything else from what is set as default in php.ini.
I dont understand this....*HELP* :-)
Thanx
/ZW
ZoombyWoof <zo************ **@thishotmail. com> wrote: I have tried all of what you suggested above, setting use_trans_sid to 1 didnt help. I used the link with session_name=se ssion_id, didnt help. I have changed session.save_pa th to /usr/local/apache2/sessions, apache owns that directory, apache is the user who runs the server, but nothing goes in that directory. I have checked the cookie_params, and it doesnt contain anything else from what is set as default in php.ini. I dont understand this....*HELP* :-)
Hm, strange, are you sure you are editing the php.ini PHP uses? Check with
phpinfo(). That will also tell you whether PHP was compiled with
--disable-session.
JOn
--
He only knew his iron spine held up the sky -- he didn't realize his brain
had fallen to the ground.
-- The Book of Serenity
On Tue, 04 Nov 2003 18:15:12 +0000, Jon Kraft wrote: ZoombyWoof <zo************ **@thishotmail. com> wrote:
I have tried all of what you suggested above, setting use_trans_sid to 1 didnt help. I used the link with session_name=se ssion_id, didnt help. I have changed session.save_pa th to /usr/local/apache2/sessions, apache owns that directory, apache is the user who runs the server, but nothing goes in that directory. I have checked the cookie_params, and it doesnt contain anything else from what is set as default in php.ini. I dont understand this....*HELP* :-)
Hm, strange, are you sure you are editing the php.ini PHP uses? Check with phpinfo(). That will also tell you whether PHP was compiled with --disable-session.
JOn
Yes, I'm editing the one PHP is using, it's /etc/php.ini, however, if you
mean that it should say --disable-session under configure command at the
top, it doesnt. Do I have to have disable-session compiled in ? Why is
this not the default, if it's necessary to get session to work...?
Thanx
/ZW
ZoombyWoof wrote: On Tue, 04 Nov 2003 15:35:08 +0000, Jon Kraft wrote:
ZoombyWoof <zo************ **@thishotmail. com> wrote:
Hi. Im very new to php, and I have a problem here that I cant find the solution for. I have problems with session variables, I want some variables to maintain their value between different php script that is being called. I have read the online manual, and here is an example from it that doesnt work for me, it illustrates very well my problem.
// Or maybe pass along the session id, if needed echo '<br /><a href="page2.php ?' . SID . '">page 2</a>'; The above will only work if you set session.use_tra ns_sid in php.ini to 1. Furthermore cookies must be accepted by your browser in order to work.
Alternative ly you could use:
echo '<br /><a href="page2.php ?'.session_name ().'='.session_ id().'">page 2</a>';
Check the session cookie on page 2 with session_get_coo kie_params() .. if that's empty, the cookie hasn't been set.
http://uk.php.net/manual/en/function...kie-params.php
HTH; JOn
I have tried all of what you suggested above, setting use_trans_sid to 1 didnt help.
Did you restart the webserver after editing php.ini? That's a commonly
overlooked step...
I used the link with session_name=se ssion_id, didnt help. I have changed session.save_pa th to /usr/local/apache2/sessions, apache owns that directory, apache is the user who runs the server, but nothing goes in that directory. I have checked the cookie_params, and it doesnt contain anything else from what is set as default in php.ini.
Be sure that session.auto_st art is off.
session.save_ha ndler needs to be set to files for session.save_pa th to
be used.
session.use_coo kies should be on if you want to use cookies. If you want
to use *only* cookies, then session.use_onl y_cookies should be on as well.
Make sure that session.gc_maxl ifetime isn't set really low (default is
1440 seconds, or 24 minutes). Same with session.cookie_ lifetime, but 0
is no exipre in this case. (Watch for session.cache_e xpire as well.)
--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
ZoombyWoof wrote: On Tue, 04 Nov 2003 18:15:12 +0000, Jon Kraft wrote:
ZoombyWoof <zo************ **@thishotmail. com> wrote:
I have tried all of what you suggested above, setting use_trans_sid to 1 didnt help. I used the link with session_name=se ssion_id, didnt help. I have changed session.save_pa th to /usr/local/apache2/sessions, apache owns that directory, apache is the user who runs the server, but nothing goes in that directory. I have checked the cookie_params, and it doesnt contain anything else from what is set as default in php.ini. I dont understand this....*HELP* :-)
Hm, strange, are you sure you are editing the php.ini PHP uses? Check with phpinfo(). That will also tell you whether PHP was compiled with --disable-session.
Yes, I'm editing the one PHP is using, it's /etc/php.ini, however, if you mean that it should say --disable-session under configure command at the top, it doesnt. Do I have to have disable-session compiled in ? Why is this not the default, if it's necessary to get session to work...?
If id did say --disable-session, then sessions would be disabled and not
available on the server.
Check the under phpinfo() for "Configurat ion File (php.ini) Path" and be
sure that it is set to /etc/php.ini, otherwise all your edits will do
nothing. Also be sure to restart apache after editing.
--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
On Tue, 04 Nov 2003 18:27:23 +0000, Justin Koivisto wrote: ZoombyWoof wrote:
*snip* Did you restart the webserver after editing php.ini? That's a commonly overlooked step...
Oh yes I did.
*snip* Be sure that session.auto_st art is off.
It is session.save_ha ndler needs to be set to files for session.save_pa th to be used.
It is session.use_coo kies should be on if you want to use cookies. If you want to use *only* cookies, then session.use_onl y_cookies should be on as well.
Cookies is on Make sure that session.gc_maxl ifetime isn't set really low (default is 1440 seconds, or 24 minutes). Same with session.cookie_ lifetime, but 0 is no exipre in this case. (Watch for session.cache_e xpire as well.)
Default values
/ZW This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mimi |
last post by:
Hello,
I am having trouble using the session vars in
PHP 4.3.9
OS: Win XP Prof
Web Server IIS (is local and there are no links to other servers from
the web pages I work on)
Browser: IE 6.0
The problem I am having is that each time I reload the same PHP page, I get
|
by: Jonathan Chong |
last post by:
I have problem with AOL browser (IE and Netscape are OK) accessing my Web
site after putting up a load balancer that will go to W1 or W2.
The problem does not happen when there is only Web server and no load
balancer installed.
The problem is on the checking of the session timeout function. This
function will check if the session variable's value is missing. If it is
missing, it will direct to time out page.
|
by: Gary |
last post by:
I am having a strange problem that I cannot solve. I have an asp page that I use for a user to login and gain access to other pages. When the user logs in I set a couple of session variables like Session("UserType") = "Sales". Then based on the Session("UserType") I use response.redirect to take the user to a specific page. The logic and response.redirect works fine on a Win2k server but when I move the page to a server running Win2003 the...
|
by: Adam Short |
last post by:
I'm having all sorts of problems with Sessions, I've been using them for
years with out a hitch, all of a sudden the last 6 - 12 months since getting
our new Win2003 server it's all gone shakey!!!
Our development server started life as an NT4 machine and has been simply
upgraded from one operating system to the next, it is now a cross, NT4
Server, Win2000 Server, Win2003 server. All development sites work fine and
under heavy stress. ...
|
by: Newton |
last post by:
Hi,
I got here the following problem. I am programming
web application for examing students.
After student will log on I need to keep his ID,
Privileges, Login, Password for manipulating with other
functions. All these information I will keep by
Session = "2"
Session = "Student"
| |
by: Scott Zabolotzky |
last post by:
I'm trying to pass a custom object back and forth between forms.
This custom object is pulled into the app using an external reference
to an assembly DLL that was given to me by a co-worker. A query-string
flag is used to indicate to the page whether it should instantiate
a new instance of the object or access an existing instance from
the calling page.
On the both pages I have a property of the page which is an
instance of this custom...
|
by: Ashish |
last post by:
Incase the problem got bogged down reposting...
Hi Gregory,
I think I didnt make myself much clear. The problem is:
1. I have one ASP.NET application (no classic asp) and it has a main page
(i.e. kinda SDI main window)
that contains an IFrame.
2. I load different ASPX pages (that belong to the same ASP.NET project) in
|
by: Alexander Widera |
last post by:
hello all,
i have a problem ...
like I already discussed in the thread "session empty" I have the following
problem:
I created a completely new web...
i added 2 files:
sessiontest1.aspx:
|
by: stclaus |
last post by:
Hi,
I'm currently experiencing a problem using sessions under php 4.4.2. I
store variables and objects inside session variables, and all works
well under php 5.x, but when I upload those pages to my hosting
(tiscali italia business) the whole site and session variables seem to
work at the beginning, but after a variable number of request
(sometimes the second, sometimes the fifteenth page requested) all the
site get stuck, every request...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |