# Problem with PHP Sessions



## rtwingfield (Jun 24, 2015)

I've resolved problems with an upgrade to Apache24, but I cannot understand PHP5.6 with regard to _sessions_.  I've just installed /usr/ports/www/*p5-PHP-Session* as an afterthought (sort of a _shot in the dark_) to the PHP5.6 installation.   From what I've read, the latter seems to be associated with a PHP interface to Perl, so is it needed with regard to the following scenario?

Using the *Zenphoto* application as an example, I'm still encountering problems regarding sessions., e.g.,  



```
Fatal error: Call to undefined function session_id() in /usr/local/www/zenphoto/zp-core/setup.php on line 66
```
​
Also, the *phpMyAdmin* application issues the following error message:


```
Cannot load session extension. Please check your PHP configuration
```

Previous versions of Zenphoto and phpMyAdmin . . .in association with PHP5.2 worked.  If the scripts do not find the session_id() function, then (otherwise) how is it (the function or extension) loaded into the PHP environment?

Per this PHP documentation:
http://php.net/manual/en/session.configuration.php#ini.session.auto-start​I've set session.auto-start to true, e.g., 
	
	



```
session.auto_start = 1
```
.  What else to do?


----------



## rtwingfield (Jun 24, 2015)

Finally found this post:
https://forums.freebsd.org/threads/php-5-5-does-not-like-sessions.45893/
which asked the question


> Did you install www/php55-session?


. . .well, no, I hadn't, so I did install php56-session.  I now find the following in the `phpinfo()` output:





and this:

```
session
session.auto_start => On => On
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => /dev/urandom => /dev/urandom
session.entropy_length => 32 => 32
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 5 => 5
session.hash_function => 0 => 0
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => /tmp => /tmp
session.serialize_handler => php => php
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_
session.use_cookies => On => On
session.use_only_cookies => On => On
session.use_strict_mode => Off => Off
session.use_trans_sid => 0 => 0
PWD => /usr/ports/www/php56-session
_SERVER["PWD"] => /usr/ports/www/php56-session
```


Still no luck with starting *phpMyAdmin*, but the failure message from *Zenphoto* is gone . . .but only a blank page displays.


----------



## junovitch@ (Jun 24, 2015)

I can't speak to the session related error but something to think about for next time is the port names.  The p5- in www/p5-PHP-Session signifies it's a Perl module which is a good first tell that it may not be what you are looking for.  As you had found, the module you were looking for started with php56-.  `pkg search php56` would have been an effective way to list what PHP modules are available.


----------



## rtwingfield (Jun 24, 2015)

junovitch said:


> I can't speak to the session related error but something to think about for next time is the port names.  The p5- in www/p5-PHP-Session signifies it's a Perl module which is a good first tell that it may not be what you are looking for.  As you had found, the module you were looking for started with php56-.  `pkg search php56` would have been an effective way to list what PHP modules are available.


. . .yep, noticed that.  Basically, it was a typo on my part.  Used `pkg delete` and `portmaster` to _hopefully_ clean it up.

EDIT *** 25 June 2015
Thanks to this post-thread
https://forums.freebsd.org/threads/opencart-php-call-to-undefined-function-hash.50583/#post-292396
I became knowledgeable in the errors of my assumptions regarding PHP and additionally downloaded the php56-extensions package.


----------

