Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sessions in PHP 7

Tags:

php

session

I have been working with PHP 5.xx for years but recently updated to PHP 7. I can't create sessions.

I have read the documentation.

In earlier PHP, you just have to do:

session_start();

to start session, but this doesn't work with PHP 7 and my page keeps loading. I provided the array in the parameter too as documented on the PHP website but still it keeps loading the page.

I have tried this:

session_start([
'cache_limiter' => 'private',
'read_and_close' => true,
]);

But my browser keeps loading and after few seconds it displays 'This webpage is not available'

Apache restart errors:

[Wed Dec 30 00:45:16.470001 2015] [mpm_winnt:notice] [pid 2384:tid 376] AH00455: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.0 configured -- resuming normal operations

[Wed Dec 30 00:45:16.470001 2015] [mpm_winnt:notice] [pid 2384:tid 376] AH00456: Apache Lounge VC14 Server built: Dec 9 2015 10:17:39

[Wed Dec 30 00:45:16.470001 2015] [core:notice] [pid 2384:tid 376] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache'

[Wed Dec 30 00:45:16.470001 2015] [mpm_winnt:notice] [pid 2384:tid 376] AH00418: Parent: Created child process 1716

[Wed Dec 30 00:45:17.172064 2015] [ssl:warn] [pid 1716:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name

[Wed Dec 30 00:45:17.343941 2015] [ssl:warn] [pid 1716:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name

[Wed Dec 30 00:45:17.375192 2015] [mpm_winnt:notice] [pid 1716:tid 384] AH00354: Child: Starting 150 worker threads.

like image 868
Waleed Avatar asked Dec 30 '15 07:12

Waleed


Video Answer


1 Answers

I found its a bug related to xampp version i.e. x86 or x64 bit. I have a system with x64 bit windows and i installed a xampp with php7 but it was x86 bit. This was a reason for that error apache crashes.

Now i separately installed apach2.4 (x64) and PHP7.0.1 which is working perfect now.

like image 162
Shri Avatar answered Oct 04 '22 23:10

Shri