Sessions in PHP 7 - php

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.

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.

Related

Apache/PHP Won't Start in Ampps

All of the sudden, Apache in Ampps won't start anymore. Of course, I have tried checking port 80, but nothing is listening/running on port 80. Please help, thank you. Also, I have checked the Apache logs and according to the logs everything is fine. But, in the Ampps UI, it says next to Apache, "Stopped."
Here is a part of the logs:
[Sun Jun 24 07:04:14.190632 2018] [core:notice] [pid 19300:tid 712] AH00094: Command line: 'apache\\bin\\httpd.exe -d C:/Program Files (x86)/Ampps/apache'
[Sun Jun 24 07:04:14.190632 2018] [mpm_winnt:notice] [pid 19300:tid 712] AH00418: Parent: Created child process 23216
[Sun Jun 24 07:04:14.910118 2018] [mpm_winnt:notice] [pid 23216:tid 724] AH00354: Child: Starting 64 worker threads.
[Sun Jun 24 07:04:27.659321 2018] [mpm_winnt:notice] [pid 21360:tid 680] AH00455: Apache/2.4.27 (Win32) OpenSSL/1.1.0f PHP/5.6.31 configured -- resuming normal operations
[Sun Jun 24 07:04:27.659321 2018] [mpm_winnt:notice] [pid 21360:tid 680] AH00456: Apache Lounge VC15 Server built: Jul 7 2017 11:43:51
I fixed it! I just had to replace all the PHP files with new ones!

xamp error apache dont want start no matter what

[ssl:warn] [pid 6880:tid 288] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 17 22:05:26.009909 2017] [ssl:warn] [pid 6880:tid 288] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 17 22:05:26.033911 2017] [mpm_winnt:notice] [pid 6880:tid 288] AH00455: Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/7.1.11 configured -- resuming normal operations
[Fri Nov 17 22:05:26.033911 2017] [mpm_winnt:notice] [pid 6880:tid 288] AH00456: Apache Lounge VC14 Server built: Oct 22 2017 11:52:30
[Fri Nov 17 22:05:26.033911 2017] [core:notice] [pid 6880:tid 288] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Nov 17 22:05:26.034911 2017] [mpm_winnt:notice] [pid 6880:tid 288] AH00418: Parent: Created child process 544
[Fri Nov 17 22:05:26.046911 2017] [:crit] [pid 544] (-2146173818)Unknown error: AH00141: Could not initialize random number generator
[Fri Nov 17 22:05:26.048911 2017] [mpm_winnt:crit] [pid 6880:tid 288] AH00419: master_main: create child process failed. Exiting.
I tried skype not working kill process skype also
I changed port to like 10 different ports not working
I don't have IIS
I tried to run the batch file via cmd
I did try reinstall clean install nothing change
Whatever I do I am getting same error.
I FIXED , i reinstall xampp so many times that I had like x6 allowed apache and mysql in the windows firewall. I removed them all did a clean install and now all works like charm !

Apache error "error AH00428: Parent: child process 11144 exited with status 255" with PHP 7

I am running Wamp server 3.0.6 64 bits with Apache 2.4.23 - MySQL 5.7.14
When I use PHP 5.6.25 everything works fine, I have no problem.
But when I use PHP 7.0.10 I get following errors on Apache log when I stress a little the application (several PHP request running at the same time and requesting mysql database through PDO connection)
[Wed Jul 26 18:55:25.459433 2017] [mpm_winnt:notice] [pid 11352:tid 616] AH00428: Parent: child process 5560 exited with status 255 -- Restarting.
[Wed Jul 26 18:55:25.613195 2017] [auth_digest:notice] [pid 11352:tid 616] AH01757: generating secret for digest authentication ...
[Wed Jul 26 18:55:25.703752 2017] [mpm_winnt:notice] [pid 11352:tid 616] AH00455: Apache/2.4.23 (Win64) PHP/7.0.10 configured -- resuming normal operations
[Wed Jul 26 18:55:25.703752 2017] [mpm_winnt:notice] [pid 11352:tid 616] AH00456: Apache Lounge VC14 Server built: Jul 1 2016 11:43:51
[Wed Jul 26 18:55:25.703752 2017] [core:notice] [pid 11352:tid 616] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.23\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.23'
[Wed Jul 26 18:55:25.703752 2017] [mpm_winnt:notice] [pid 11352:tid 616] AH00418: Parent: Created child process 12680
[Wed Jul 26 18:55:27.304382 2017] [auth_digest:notice] [pid 12680:tid 648] AH01757: generating secret for digest authentication ...
[Wed Jul 26 18:55:27.324432 2017] [mpm_winnt:notice] [pid 12680:tid 648] AH00354: Child: Starting 64 worker threads.
I saw some posts with similar error on stackoverflow, but no answer solve my problem and there is no mention of PHP version that would cause that error.
Did anyone meet / solve that problem?
Thank you!
I had some deprecated php_value settings defined in httpd.conf that weren't indicated anywhere. Removing deprecated configurations stopped httpd.exe from crashing.

ERR_CONNECTION_RESET error on local machine running xampp with php7

I recently updated my xampp installation to current version with php7, however every thing seem to work fine until i tried testing out a laravel 5.2 project.
Accessing a page that doesn't make a database connection has no issue, but trying accessing a route that makes a db query i get the error "ERR_CONNECTION_RESET".
The error log doesn't really show any concrete errors that cause this.
[Fri Apr 22 20:50:41.365814 2016] [ssl:warn] [pid 2856:tid 436] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Apr 22 20:50:41.422857 2016] [mpm_winnt:notice] [pid 2856:tid 436] AH00455: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.5 configured -- resuming normal operations
[Fri Apr 22 20:50:41.422857 2016] [mpm_winnt:notice] [pid 2856:tid 436] AH00456: Apache Lounge VC14 Server built: Dec 9 2015 10:17:39
[Fri Apr 22 20:50:41.422857 2016] [core:notice] [pid 2856:tid 436] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Apr 22 20:50:41.427857 2016] [mpm_winnt:notice] [pid 2856:tid 436] AH00418: Parent: Created child process 7024
I have gone through php.ini configuration several times. What could cause this problem?

What may cause an ERR_CONNECTION_RESET error, on xampp while using session

I have problem with xampp (Windows) where I have session_start(); in my file but it like drops that request...
When I try to access page with localhost/folder/index.php it works but when i try
external ip/folder/index.php or 127.0.0.1/folder/index.php or [::1]/folder/index.php it just drops connection (tried multiple browsers and chrome gives ERR_CONNECTION_RESET... I am clueless and I desperately need help...
It worked when I removed session_start(); from my file...
When I make new file with session_start(); it still doesn't work...
Some error.log lines
[Sun Jan 10 19:33:45.805036 2016] [:error] [pid 3176:tid 1888] [client myip:50143] script 'C:/xampp/htdocs/h3x1t/i\xc2\xb4\xc2\xb4.php' not found or unable to stat
[Sun Jan 10 20:02:40.330149 2016] [ssl:warn] [pid 24588:tid 552] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:02:40.373728 2016] [mpm_winnt:notice] [pid 24588:tid 552] AH00354: Child: Starting 150 worker threads.
[Sun Jan 10 20:04:25.949925 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00428: Parent: child process 24588 exited with status 3221225477 -- Restarting.
[Sun Jan 10 20:04:26.568746 2016] [ssl:warn] [pid 29460:tid 564] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:04:26.615700 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00455: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.1 configured -- resuming normal operations
[Sun Jan 10 20:04:26.615700 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00456: Apache Lounge VC14 Server built: Dec 9 2015 10:17:39
[Sun Jan 10 20:04:26.615700 2016] [core:notice] [pid 29460:tid 564] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Jan 10 20:04:26.622190 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00418: Parent: Created child process 26200
[Sun Jan 10 20:04:27.302705 2016] [ssl:warn] [pid 26200:tid 560] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:04:27.475560 2016] [ssl:warn] [pid 26200:tid 560] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:04:27.518770 2016] [mpm_winnt:notice] [pid 26200:tid 560] AH00354: Child: Starting 150 worker threads.
[Sun Jan 10 20:04:28.693791 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00428: Parent: child process 26200 exited with status 3221225477 -- Restarting.
[Sun Jan 10 20:04:29.379751 2016] [ssl:warn] [pid 29460:tid 564] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:04:29.425188 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00455: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/7.0.1 configured -- resuming normal operations
[Sun Jan 10 20:04:29.425188 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00456: Apache Lounge VC14 Server built: Dec 9 2015 10:17:39
[Sun Jan 10 20:04:29.425188 2016] [core:notice] [pid 29460:tid 564] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun Jan 10 20:04:29.430191 2016] [mpm_winnt:notice] [pid 29460:tid 564] AH00418: Parent: Created child process 30668
[Sun Jan 10 20:04:30.081357 2016] [ssl:warn] [pid 30668:tid 608] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:04:30.254197 2016] [ssl:warn] [pid 30668:tid 608] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Jan 10 20:04:30.297173 2016] [mpm_winnt:notice] [pid 30668:tid 608] AH00354: Child: Starting 150 worker threads.
[Sun Jan 10 20:06:24.444492 2016] [:error] [pid 30668:tid 1896] [client ::1:60405] script 'C:/xampp/htdocs/h3x1t/contracts.php' not found or unable to stat, referer: http://localhost/h3x1t/index
I have XAMPP with PHP7 and the same problem...
I've changed in php.ini:
session.use_only_cookies from 0 to 1 and all works.
I reinstalled xampp with older PHP Version...
Looks like culprit was PHP 7.0.0
EDIT: Found something probably linked to it
https://community.apachefriends.org/viewtopic.php?p=248070&sid=0b7559defe15317f41699d1ce9194e3f
EDIT2: Found this (bitnami developers)
we have been checking the configuration of XAMPP and we found that the
issue is related to the use_only_cookies variable that you can find in
the Session's section of the php.ini file. Apache will crash if the
use_only_cookies variable in the Session's section is set to 0 and
everything is fine if it's set to 1.
http://php.net/manual/en/session.configuration.php#ini.session.use-only-cookies
We also checked that the use_strict_mode should be set to 1.
https://wiki.php.net/rfc/strict_sessions
http://php.net/manual/en/session.configuration.php#ini.session.use-strict-mode
We'll include those changes in the next version of XAMPP with PHP 7.
We are building the installers with the version 7.0.2 and we'll
release them as soon as possible.
In my case, Windows Event Viewer showed more useful data. It pointed to VCRUNTIME140.dll constantly crashing Apache (which caused the console to show ERR_CONNECTION_RESET), so I updated libraries to https://www.microsoft.com/en-us/download/confirmation.aspx?id=52685 - then, it showed faulting module as php7ts.dll - so I've followed instructions from http://ibraransari.blogspot.com/2017/01/how-to-solve-apache-crash-fault-module.html and I was good to go.
If things still dont work when you applied the above two answers,Clear out the cache this should solve the problem.

Categories