Forum Moderators: coopster
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count']=0;
} else {
$_SESSION['count']++;
}
echo '<a href="https://www.mydomain.com/dev/showcookie.php">Go to second page</a>';
echo '<pre>';
print_r($_SESSION);
print_r(session_get_cookie_params());
_Go to second page_
Array
(
[count] => 2
)
Array
(
[lifetime] => 2592000
[path] => /
[domain] =>
[secure] => 1
[httponly] => 1
)
session_start();
print_r($_SESSION);
print_r($_SERVER);
Array
(
)
Array
(
[UNIQUE_ID] => S7ET-NA5jJkAAA3fJOMAAAAB
[HTTPS] => on
[HTTP_HOST] => www.mydomain.com
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 115
[HTTP_CONNECTION] => keep-alive
[HTTP_REFERER] => https://www.mydomain.com/dev/setcookie.php
[HTTP_COOKIE] => PHPSESSID=1fw1K3Xv6w6aKgTiBAt-IPFwt4a
[PATH] => /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache
[SERVER_NAME] => www.mydomain.com
[SERVER_ADDR] => 208.57.140.155
[SERVER_PORT] => 443
[REMOTE_ADDR] => 71.177.216.6
[DOCUMENT_ROOT] => /home/healthpl/public_html
[SERVER_ADMIN] => webmaster@mydomain.com
[SCRIPT_FILENAME] => /home/healthpl/public_html/dev/showcookie.php
[REMOTE_PORT] => 14156
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /dev/showcookie.php
[SCRIPT_NAME] => /dev/showcookie.php
[PHP_SELF] => /dev/showcookie.php
[REQUEST_TIME] => 1269896188
[argv] => Array
(
)
[argc] => 0
)
https://www.mydomain.com/dev/showcookie.php
GET /dev/showcookie.php HTTP/1.1
Host: www.mydomain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://www.mydomain.com/dev/setcookie.php
Cookie: PHPSESSID=1fw1K3Xv6w6aKgTiBAt-IPFwt4a
HTTP/1.1 200 OK
Date: Mon, 29 Mar 2010 20:56:28 GMT
Server: Apache
Set-Cookie: PHPSESSID=gwLgrZ%2CSkQze0EgvFdETMpZbfQd; expires=Wed, 28-Apr-2010 20:56:28 GMT; path=/; secure; HttpOnly
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
Content-Length: 1510
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html
shell> stat /tmp/sess_1fw1K3Xv6w6aKgTiBAt-IPFwt4a
File: `/tmp/sess_1fw1K3Xv6w6aKgTiBAt-IPFwt4a'
Size: 10 Blocks: 2 IO Block: 4096 regular file
Device: 700h/1792d Inode: 6107 Links: 1
Access: (0600/-rw-------) Uid: ( 99/ nobody) Gid: ( 99/ nobody)
Access: 2010-03-29 13:58:29.000000000 -0700
Modify: 2010-03-29 13:56:26.000000000 -0700
Change: 2010-03-29 13:56:26.000000000 -0700
shell> locate php.ini
/php.ini
/etc/php.ini
/home/cpeasyapache/src/php-5.2.9/php.ini-dist
/home/cpeasyapache/src/php-5.2.9/php.ini-recommended
/scripts/php.ini
/usr/lib/php.ini
/usr/local/cpanel/3rdparty/etc/php.ini
/usr/local/cpanel/3rdparty/etc/php.ini,v
/usr/local/cpanel/3rdparty/etc/php.ini.dist
/usr/local/cpanel/3rdparty/etc/php.ini.keep
/usr/local/cpanel/3rdparty/etc/horde/php.ini
/usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini
/usr/local/cpanel/3rdparty/etc/phppgadmin/php.ini
/usr/local/cpanel/3rdparty/etc/roundcube/php.ini
/usr/local/cpanel/3rdparty/lib/php.ini,v
/usr/local/lib/php.ini
/usr/local/lib/php.ini,v
/usr/local/lib/php.ini-zend_optimizer.bak
shell> php -i
phpinfo()
PHP Version => 5.2.9
System => Linux pebblebeach.mydomain.com 2.6.18-164.2.1.el5.plusPAE #1 SMP Fri Oct 9 13:15:48 EDT 2009 i686
Build Date => Jun 15 2009 22:50:24
Configure Command => './configure' '--disable-pdo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-sockets' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mssql=/usr/local/freetds' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Scan this dir for additional .ini files => (none)
additional .ini files parsed => (none)
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, data, http, ftp, compress.zlib, https, ftps
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*
<snip>
GET /dev/showcookie.php HTTP/1.1
Host: www.mydomain.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: https://www.mydomain.com/dev/setcookie.php
Cookie: PHPSESSID=XNn8DTlAGSF81hnuGNrv4IFkWUa
Pragma: no-cache
Cache-Control: no-cache
HTTP/1.1 200 OK
Date: Mon, 29 Mar 2010 22:54:28 GMT
Server: Apache
Set-Cookie: PHPSESSID=CZ4EVpcb0CmoGN0GK47sCtZzs%2Cd; expires=Wed, 28-Apr-2010 22:54:28 GMT; path=/; secure; HttpOnly
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
Content-Length: 1577
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html
session.save_handler = files
session.save_path = "/tmp"
session.use_cookies = 1
session.use_only_cookies = 1
session.cookie_secure = 1
session.cookie_httponly = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 2592000
session.cookie_path = "/"
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 2592000
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check = "www.my-freaking-old-domain.com"
session.entropy_length = 512
session.entropy_file = "/dev/urandom"
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 1
session.hash_bits_per_character = 6
[edited by: eelixduppy at 1:20 pm (utc) on Mar 30, 2010]
[edit reason] changed link [/edit]