3

I have laravel 4.2 installed in a local environment (windows 10) for testing, but keep getting a connection reset error after updating any files.

My project will load and the server properly displays my pages. However if I update a file (index for example) and then try access a page that renders the newly updated file, I always get a connection reset error. Even a change as simple as a period.

Even more interesting is when I use php artisan to serve my files, I never get the connection reset problem. If I visit the page through artisan serve it works, and then all the sudden xampp wants to work, but only after I have loaded the page from artisan once before.

If I make changes to the file again I have to repeat this process.

Local Setup

My project is being hosted locally from xampp (v 3.2.2) with the following v-hosts config. The hosts files have also been properly configured.

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/myproject/public"
ServerName myproject.local
ServerAlias myproject.local
ErrorLog "logs/myproject.log"
CustomLog "logs/custom.myproject.log" combined
<Directory "C:/xampp/htdocs/myproject/public">
    AllowOverride All
    Require all granted
</Directory>

In short: I change a file, I get connection reset on xampp when trying to access that page. I view the page from artisan and then refresh the page on xampp, all the sudden it works.

Update

I have tried alternates such as laragon suggested by Lucas, however the same error persists. After updating any file when trying to access that page I get a connection reset error.

I have found more information looking at the apache log in laragon.

[Tue Mar 01 08:52:22.785519 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00428: Parent: child process 8276 exited with status 3221225725 -- Restarting.
[Tue Mar 01 08:52:22.928687 2016] [ssl:warn] [pid 6748:tid 544] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Mar 01 08:52:22.938712 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00455: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.16 configured -- resuming normal operations
[Tue Mar 01 08:52:22.938712 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00456: Apache Lounge VC11 Server built: Oct 13 2015 10:54:13
[Tue Mar 01 08:52:22.938712 2016] [core:notice] [pid 6748:tid 544] AH00094: Command line: 'C:\\laragon\\bin\\apache\\apache-2.4.17/bin/httpd -d C:/laragon/bin/apache/apache-2.4.17'
[Tue Mar 01 08:52:22.939695 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00418: Parent: Created child process 3672
[Tue Mar 01 08:52:23.214917 2016] [ssl:warn] [pid 3672:tid 532] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Mar 01 08:52:23.296629 2016] [ssl:warn] [pid 3672:tid 532] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Mar 01 08:52:23.306647 2016] [mpm_winnt:notice] [pid 3672:tid 532] AH00354: Child: Starting 64 worker threads.
[Tue Mar 01 08:52:24.159843 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00428: Parent: child process 3672 exited with status 3221225725 -- Restarting.
[Tue Mar 01 08:52:24.305896 2016] [ssl:warn] [pid 6748:tid 544] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Mar 01 08:52:24.315916 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00455: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.16 configured -- resuming normal operations
[Tue Mar 01 08:52:24.315916 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00456: Apache Lounge VC11 Server built: Oct 13 2015 10:54:13
[Tue Mar 01 08:52:24.315916 2016] [core:notice] [pid 6748:tid 544] AH00094: Command line: 'C:\\laragon\\bin\\apache\\apache-2.4.17/bin/httpd -d C:/laragon/bin/apache/apache-2.4.17'
[Tue Mar 01 08:52:24.317905 2016] [mpm_winnt:notice] [pid 6748:tid 544] AH00418: Parent: Created child process 3600
[Tue Mar 01 08:52:24.580068 2016] [ssl:warn] [pid 3600:tid 552] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Mar 01 08:52:24.666114 2016] [ssl:warn] [pid 3600:tid 552] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Mar 01 08:52:24.675120 2016] [mpm_winnt:notice] [pid 3600:tid 552] AH00354: Child: Starting 64 worker threads.
Olixr
  • 91
  • 1
  • 9
  • I have a tutorial on how to create a virtual host for development on my site. Might have to port it to Windows though since it is for Linux http://simpledeveloper.com/how_to_setup_virtual_host_in_apache/ – Eenvincible Mar 01 '16 at 15:01

3 Answers3

6

This issue was finally resolved with a configuration change with Apache.

Add the following to the httpd.conf file:

<IfModule mpm_winnt_module>
   ThreadStackSize 8888888
</IfModule>

Then Restart.

The problem is that windows has a smaller stack size by default than on the Linux/Unix systems. It took me a while to figure this out. Apache was silently crashing and I was getting no errors in my logs making it hard to trace.

The project I am working on has large regular expression calls and apparently this was a known trigger to cause this issue with apache on windows. If you look at apache documentation we can update the ThreadStackSize to a value closer to Unix/Linux systems of 8MB.

http://httpd.apache.org/docs/2.2/mod/mpm_common.html#ThreadStackSize

I hope this helps anyone else developing on a windows system running apache as a local server. This was a major headache for some time.

Olixr
  • 91
  • 1
  • 9
  • I never had this problem while developing on windows, but is good to know how to solve it if happen in the future. – Lucas Silva Mar 01 '16 at 18:10
  • 1
    @Lucas yea this is my first encounter with this issue. In fact it took about 2 months to finally solve this one. – Olixr Mar 02 '16 at 20:56
  • @Olixr I've been stuck with this problem for several weeks. I'm on Laravel 5.5, PHP 7.3 and Apache 2.4.x and I still can't get past it. Please see this question: https://stackoverflow.com/questions/54130437/laravel-5-5-why-is-exception-not-thrown-by-foreign-key-violation-from-delete-met – DavidHyogo Jan 13 '19 at 16:32
  • I have been trying to solve the same issue but luckily @Olixr's solution worked for me, which took me 2 days to get the solution. – Codeparl Jan 30 '23 at 12:13
1

php artisan serve use the PHP built on server (php -S localhost:80 -t public) to host the application.

Maybe the problem can be your apache configuration, so try this:

# define DOCROOT variable
define DOCROOT "C:/xampp/htdocs"

<Directory "${DOCROOT}">
    AllowOverride All
    Require all granted
</Directory>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/myproject/public/"
    ServerName myproject.dev
</VirtualHost>

if the problem persists, try use Laragon and open it always as administrator.

Lucas Silva
  • 1,361
  • 1
  • 13
  • 18
  • Thanks for the response, I have tried to apache config update to no avail. I have the exact same setup on another computer and can't get this issue to reproduce. I have also completely removed xampp and reinstalled but the issue persists. The built in php server didn't work well (had many asset issues). I am currently trying to download laragon and see what we get from that route. Any other options are appreciated. – Olixr Feb 29 '16 at 22:07
  • Let me know if you liked Laragon. – Lucas Silva Mar 01 '16 at 02:20
  • Laragon looks nice and simple to use, however the same error still persists (Connection Reset). I have updated my question with more information. – Olixr Mar 01 '16 at 14:59
  • This helped me see the problem is definitely with my local Windows Apache configuration. The Laravel app is working fine on the PHP built-in server. – DavidHyogo Jan 13 '19 at 16:42
0

Opening php error log may help you find the real problem. there was an error in my codes( using isset() directly on a function )

AMIB
  • 3,262
  • 3
  • 20
  • 20