473,382 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

$_SESSION, autostart

I just started with a service provider who's giving me a server to put
my scripts. I noticed when I copy scripts that work on my machine to
this server, all things $_SESSION are null. I read some on php.net and
found that session_autostart has to be set to true in order for me to
use $_SESSION variables at all. Am I reading that right? Obviously, I
have no control over this setting on someone else's server so I cannot
change it. Is this why my $_SESSION values are all null? Is there a
workaround? I tried putting session_start(); at the very beginning of
the first script. No change.

Thanks in advance,
Jeff Sandler
Jul 17 '05 #1
1 2417
"Jeff Sandler" wrote
I read some on php.net and found that session_autostart has to
be set to true in order for me to use $_SESSION variables at all.
Am I reading that right?
No, read on. If you still know where you've read that then please anotate
that very page with whatever you're learning here...
Obviously, I have no control over this setting on someone
else's server so I cannot change it.
This is your lucky day ;-) Note that http://php.net/session states
PHP_INI_ALL for this option, so you can also override in the PHP script
itself (well, that could hardly be called "auto start" then; use
session_start() instead) or when using Apache you can enable it in a
..htaccess file in your script's directory, or even in your own root
directory. See http://php.net/ini-set and
http://php.net/configuration.changes

Note that the correct full name is

session.auto_start

so for Apache you'd use

php_flag session.auto_start on

Note that using session.auto_start is not always a good choice: you cannot
put any objects in your session... Again, read http://php.net/session or
read on to use session_start()...
I tried putting session_start(); at the very beginning of
the first script. No change.


When not using the auto start setting, you need the session_start() in every
script that is invoked by your visitor (as in: every page, even if it is not
using any session data, in order to keep the session alive when the visitor
is not accepting cookies), not just in the first one.

In general, you'll see if sessions are working if PHP is trying to set a
cookie. Type

javascript:alert(document.cookie);

in the Location / URL / Address field of your browser to see if any cookie
is set. Furthermore, on the very first page that you started the session on,
you *might* find that all relative URLs have a PHPSESSID GET parameter
appended to them (depends on your settings).

Adriaan.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Behrang Karimibabak | last post by:
Hi! I have installed EasyPHP on my computer for testing PHP-Scripts. I have also written a whole System and it works fine when I Upload it to the actual server where it should be. The problem...
0
by: Phil Powell | last post by:
What is the most standardized method of utilizing the CURL functions in PHP (version 4.3.2) to be able to retrieve the contents of a remote URL that happens to be dependent upon $_SESSION for its...
1
by: timtos | last post by:
How can I tell a setup project to put a file to the startup folder of a user only when he selected this option. To give the user the possibility to select this option I´ve inserted a two radio...
4
by: Dica | last post by:
based on a previous thread, i've been advised that using the system registry isn't always the best way to store user config details (due to portability issues). from my understanding, however,...
21
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different...
12
by: Michael Windsor | last post by:
I've been trying to integrate some PHP pages of my own with some existing code. The details of this are for the support forums for that code (where I have been asking questions), but I wonder if...
4
by: Joh | last post by:
I've developed an application that is launched at system startup. Is there a way to detect when an application is started by autostart and when its launched by a user?
2
by: Ultrak The DBA | last post by:
Using the following query: select substr(reg_var_name,1,24) as reg_var_name, substr(reg_var_value, 1,12) as reg_var_value, level from table(sysproc.reg_list_variables()) as registryinfo; I am...
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.