Laravel second app show error. While the first app is busy and running some kind of big loop in first app.
-
Hi,
I am running some code on my first app which is sending data to server and update the local database.
This process take too much time.During this time i am not able to run 2nd Laravel app. Slim framework app is also showing 404 page.
After stopping the process in first app. All other app start working.
-
@shah : If you use Nginx, you can increase the number of PHP Upstream Processes.
Here's how:- Open usr\laragon.ini (Menu > Laragon > Settings file: laragon.ini)
- Put
Upstream=5
under [nginx] section
[nginx] Upstream=5
-
@leokhoa Thank you @leokhoa ! But it is still not working. I have done the above steps as you said and restart laragon after that. But it is still not working. here is my laragon.ini file
[nginx]
Version=nginx-1.10.1
Use=-1
DocumentRoot=D:
Upstream=5
-
@shah : Did you use
localhost
orpretty urls
?
If you use app1.dev (for the long running process) and (app2.dev for other) it should work. Otherwise, you can try to increase theUpstream
to larger value (10). I don't think your app1.dev will hold all 10 PHP processes.
-
@leokhoa Yes i am using pretty urls. And sorry! i am using apache(Apache httpd-2.4.25-win32-VC14). So i think that's why Upstreams is not working.
[apache]
Version=httpd-2.4.25-win32-VC14
Use=-1
DocumentRoot=D:
Port=80
SSLEnabled=0
-
@shah : Oh, that's the reason why you still have problem.
Upstream
works only for Nginx, it will create separate PHP processes to serve other requests so you will not see your application blocking. Just enable Nginx in (Preferences > Services & Ports) to see the result.
-
@leokhoa I am not able to change it. The option is already checked but also disabled.
-
@shah : Check if you have Nginx at
bin\nginx
. Otherwise you can download nginx and put it there:
http://nginx.org/download/nginx-1.12.1.zipOn laragon.ini, remember to update your Nginx version.
-
@leokhoa I got the following error
Service Nginx can not start. Reason:
------------------------------------------------------------
'C:\laragon\bin\nginx\temp\nginx' is not recognized as an internal or external command, operable program or batch file.
-
@shah : I wonder why
temp
there?
You should have a directory structure like this:-- C:\laragon\ -- bin\ -- nginx\ -- nginx-1.12.1\ -- nginx.exe -- conf\ -- temp\
-
nginx has been installed and running on port 8080 . But nothing happens. I am still getting the same error on my second app.
here are the laragon.ini configration for nginx[nginx]
Version=nginx-1.12.1
Use=-1
DocumentRoot=D:\
Upstream=10
SSLEnabled=0
Port=8080
-
@shah : Are you sure?
Suppose you use http://app1.dev on Apache2,
You can use http://app2.dev:8080 on NginxI don't know why your app2 still have error.
-
@leokhoa Ohh Sorry! I was not accessing it on port 8080. Now i am able to access the site but the app was redirected to Document Root: C:/laragon/www. When i change root property to "D:/" in Nginx > site-enabled > 00-default.config Now it showing this error
nginx:[emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 32
-
Thank you @leokhoa . The problem has been fixed after adding the below line to
server_names_hash_bucket_size 64;
To bin\nginx\nginx-1.12.1\conf\nginx.conf
http { .... .... server_names_hash_bucket_size 64; }
-
@shah : I'm glad to hear your issue has been fixed
Cheers!