Running Laravel on local machine - php

I am trying to run a laravel project in my local machine. It starts normally on http://127.0.0.1:8000 but when I try to open the url in the browser the port changes to 8001 and the new url is http://127.0.0.1:8001. When I try to open this in the browser, again the port changes to 8002.
Image showing the issue
composer.json
My PHP version is 7.4.1. If anyone else faced this issue earlier or knows how to fix this issue, please help in fixing this issue.
Thank you.
Update 1:
Noticed something. Whenever database related code is executed, this issue is popping up. For example, when I try to execute the following code shown in the image, it runs smoothly and I can see the output in the browser. Case when the code runs smoothly
But when I change the code to the following, the issue shows up.
Case when the issue shows up. This is not any database heavy query but why this issue? Any leads would be very helpful.
Update 2:
Found nothing in laravel logs but found the following in the apache error log which is given below:
[Thu Jun 09 21:37:24.988703 2022] [mpm_winnt:crit] [pid 2660:tid 704] AH02538: Child: Parent process exited abruptly. Child process is ending
[Thu Jun 09 21:37:27.399609 2022] [core:warn] [pid 8084:tid 576] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Jun 09 21:37:27.446479 2022] [mpm_winnt:notice] [pid 8084:tid 576] AH00455: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.1 configured -- resuming normal operations
[Thu Jun 09 21:37:27.446479 2022] [mpm_winnt:notice] [pid 8084:tid 576] AH00456: Apache Lounge VC15 Server built: Aug 11 2019 12:20:04
[Thu Jun 09 21:37:27.446479 2022] [core:notice] [pid 8084:tid 576] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache'
[Thu Jun 09 21:37:27.446479 2022] [mpm_winnt:notice] [pid 8084:tid 576] AH00418: Parent: Created child process 10064
[Thu Jun 09 21:37:28.196453 2022] [mpm_winnt:notice] [pid 10064:tid 664] AH00354: Child: Starting 150 worker threads.

Try this parameter I think help you
php artisan serve --port=8080

This highly, might be a problem to the code, you've write-ed, not a Laravel problem. I've faced issues like this before for a long time ago, so you might check :
The code is processing in blade or controller.
Or it might be a memory issues related to PC (might not be, related to this issue, but i had a lots of memory issues back then when i had low-end PC and all these issues was happening.)
As I said, my first guess is the code, so you might need to share the code find out, what is happening.
Also conflicts in reserved ports will be avoided anyway, for example if you set your local environment server to something else(8080), same issue will happen again.
And sometime if you close your terminal without closing local environment, new php artisan serve will run the local environment anyway, for example, my terminal/IDE was closed but application was serving, and doing php artisan serve not forced me to close and run a new local environment like yours, it was trying to serve again, but old one was doing conflicts.
So as I said again, it might be a code issue.
Double check your code or share it to find the issue.

Related

Softaculous Ampps 3.8 Apache not starting if i change PHP version to 7.1

I have a recent problem in Ampps Software on Windows 10, Apache stopping automatically if PHP version is 7.1 but if I change back PHP Version to 5.6 it's working fine
and here's the error log for Apache
<pre>
[Mon Oct 22 10:28:12.413768 2018] [mpm_winnt:notice] [pid 12484:tid 684] AH00455: Apache/2.4.27 (Win32) OpenSSL/1.1.0f PHP/5.6.31 configured -- resuming normal operations
[Mon Oct 22 10:28:12.413768 2018] [mpm_winnt:notice] [pid 12484:tid 684] AH00456: Apache Lounge VC15 Server built: Jul 7 2017 11:43:51
[Mon Oct 22 10:28:12.413768 2018] [core:notice] [pid 12484:tid 684] AH00094: Command line: 'apache\\bin\\httpd.exe -d D:/Ampps/apache'
[Mon Oct 22 10:28:12.417758 2018] [mpm_winnt:notice] [pid 12484:tid 684] AH00418: Parent: Created child process 5924
[Mon Oct 22 10:28:13.307885 2018] [mpm_winnt:notice] [pid 5924:tid 740] AH00354: Child: Starting 64 worker threads.
[Mon Oct 22 10:28:45.068164 2018] [mpm_winnt:notice] [pid 9816:tid 700] AH00455: Apache/2.4.27 (Win32) OpenSSL/1.1.0f PHP/7.1.8 configured -- resuming normal operations
[Mon Oct 22 10:28:45.068164 2018] [mpm_winnt:notice] [pid 9816:tid 700] AH00456: Apache Lounge VC15 Server built: Jul 7 2017 11:43:51
[Mon Oct 22 10:28:45.068164 2018] [core:notice] [pid 9816:tid 700] AH00094: Command line: 'apache\\bin\\httpd.exe -d D:/Ampps/apache'
[Mon Oct 22 10:28:45.070158 2018] [mpm_winnt:notice] [pid 9816:tid 700] AH00418: Parent: Created child process 15180
[Mon Oct 22 10:28:47.563384 2018] [mpm_winnt:crit] [pid 9816:tid 700] AH00419: master_main: create child process failed. Exiting.
</pre>
I didn't change anything or install anything new, and I reinstalled it many times and tried XAMPP it's working fine
Thank you.
Its solved by disabling Ioncube loader extension for me, Thanks for all replies
Try changing the php version used by AMPPS by following their guide here ->
http://www.ampps.com/wiki/How_to_change_php_version
In the AMPPS control panel, select options and then select change php version. The changed version should now be displayed in the control panel.
Try run httpd.exe with as administrator and it worked.
C:\Program Files (x86)\Ampps\apache\bin
I know this is 4 months old, but I have had significant problems with PHP on windows and today I got this problem fixed.
AMPPS - It won’t run PHP 7.1 with out changing the executables to run as administrator mode. Apache will terminate without an error. I believe this is because even if AMPPS is running in admin priviledges these are not granted to the php.exe when it is run. Go to the file location of php.exe, right click and click on properties, click the compatibility tab and select the check box for ‘run as administrator’. Do the same for the httpd.exe under apache->bin->httpd.exe. (Not sure if the httpd priviledge change matters but I did it and it worked.)
Run AMPPS and hopefully like me, your php/apache problems are gone.
i solved mine following steps below:
i switched PHP version to 5.6 which everything works normally,
then went to this URL:
http://localhost/ampps/index.php?
there i found some updates available
notification on top of the page below url bar on the page
if you see updates available for your php 7.0 7.1 ...
90% you will resolve this issue like mine
i tried update all available updates
then restart the ampps app
now working with PHP 7.1 great.
i hope it works for you as well.
A bit late but since i've been using Ampps for 5 years , i provide similar solutions for my common errors maybe someone find it useful .
If you changed Document Root path in "httpd.conf" , make sure that folder still exists.
If you see the logs about InnoDB files, follow the path and delete that dump files and logs.
If you got this error "master_main: create child process failed" in log files :
Change PHP version to 7.1 and Try this:
Open AMPPS panel --> PHP --> Configuration.
Search for the following line and comment it by adding ';' at the beginning of the line: zend_extension="{$path}\php-7.1\ioncube_loader_win_7.1.dll"

XAMPP v.3.2.1: Apache crashes when I try to add variables to a session

Problem: Apache keeps crashing if I try to update the global $_SESSION variable in PHP. These are the entries added to error.log in case of a crash.
From apache\logs\error.log:
[Mon Jun 29 14:10:34.142373 2015] [mpm_winnt:notice] [pid 6644:tid 316] AH00428: Parent: child process 1440 exited with status 3221225477 -- Restarting.
[Mon Jun 29 14:10:34.262613 2015] [mpm_winnt:notice] [pid 6644:tid 316] AH00455: Apache/2.4.12 (Win32) PHP/5.6.8 configured -- resuming normal operations
[Mon Jun 29 14:10:34.262613 2015] [mpm_winnt:notice] [pid 6644:tid 316] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Mon Jun 29 14:10:34.262613 2015] [core:notice] [pid 6644:tid 316] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Mon Jun 29 14:10:34.266524 2015] [mpm_winnt:notice] [pid 6644:tid 316] AH00418: Parent: Created child process 6376
[Mon Jun 29 14:10:35.026097 2015] [mpm_winnt:notice] [pid 6376:tid 428] AH00354: Child: Starting 150 worker threads.
Windows Event viewer
About my source code: I have a php script and intend to add variables to an existing session. For that matter, I use $_SESSION and set some keys to arrays, i.e. $_SESSION['foo'] = bar, where bar is an array containing objects of a very simple class having only some string attributes.
If I do that the first time, I'm fine. If I re-assign a value to $_SESSION['foo'] after reloading the page, Apache crashes and immediately restarts. I was able to isolate the crash to this very line, as commenting it out turned out to prevent the crash. First, I assumed my session is somehow corrupted or I use it incorrectly. But if I manually set $_SESSION['foo'] = "", instead of assigning an array, no crash occurs.
Similar reports I found in the web had different error sources, so I tried a few things, e.g.:
Run XAMPP as administrator
Increase the thread stack size in httpd.conf
Deactivate unused php-extensions
Switched to different ports, etc.
Turned off SSL
Unfortunately, nothing helped in my case.
PS: I use XAMPP v.3.2.1 with PHP 5.6.8 on Windows 8.1 (64bit).
EDIT: As suggested by donald123, I turned off SSL. The error persists, but I posted a cleaner log snippet.

The requested URL /LearnPHP5/learnPHP.php was not found on this server

I just downloaded Eclipse for Linux. Started a PHP tutorial and immediately hit a roadblock. The code is small:
<?php
echo 'Hello PHP World!';
When I run it as web application, I get:
Not Found
The requested URL /LearnPHP5/learnPHP.php was not found on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
I have the Web Developer Tools installed on Eclipse, PHP installed on my Linux. and Apache2 running. I have this same issue with NetBeans too. Does anyone know why I'm getting this error? I have tried everything seen on the SO posts regarding this, but nothing has remedied the situation. I've been trying to sort it out all day. Any help wld be greatly appreciated.
This is from my apache error log:
[Fri Dec 05 16:39:17.808812 2014] [mpm_event:notice] [pid 8660:tid 140438963517312] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Fri Dec 05 16:39:17.808955 2014] [core:notice] [pid 8660:tid 140438963517312] AH00094: Command line: '/usr/sbin/apache2'
[Fri Dec 05 16:39:31.664085 2014] [mpm_event:notice] [pid 8660:tid 140438963517312] AH00491: caught SIGTERM, shutting down
[Fri Dec 05 16:39:32.768582 2014] [mpm_prefork:notice] [pid 9978] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Fri Dec 05 16:39:32.768695 2014] [core:notice] [pid 9978] AH00094: Command line: '/usr/sbin/apache2'
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
I'm open to all advice. Never seen such a dilemma over such a small amount of code.
Look at log file (usually /var/log/apache2/error.log), where apache try to find your file /LearnPHP5/learnPHP.php .
It's seems like some mistake in the path to www root directory.

Server truncates/interrupts output when request comes from external computer, but not from 127.0.0.1

Setup:
EasyPHP Dev server 13.1VC11 (Apache 2.2.4, MySQL 5.6.12, PHP 5.5.0)
Windows 7.
Apache is set up with multiple virtual hosts each pointing to a separate folder under ...data\localweb\.
Server also acts as a gateway between internet and local network.
My wife has made a webpage which includes JavaScript and jQuery and PHP.
When I open a browser on my server computer and access the pages, everything works as they should. Via both these addresses:
http://127.0.0.1/liselotte/projekt5/2vs.php
http://liselotte.mine.nu/projekt5/2vs.php
However, when I try to access the page from another computer on my local network, the two longer pages in my wife's project gets truncated. (file 2vs.php, also accessible on the page's main menu as "V/S") It always gets truncated at the same place, in the middle of a 8-letter word, in a piece of HTML formatted text.
I use Firefox and can see when the code cuts off before the browser displays an error message that "transfer was aborted". (It's in Swedish, so I'm a bit uncertain about the exact wording of the message) "The connection to the server was severed during retrieval of the page". (no HTTP-error number)
I have also tried Internet Explorer and Chrome, transfer is cut off at the exact same place every time.
Weirdly enough, the page seems to work when accessed from internet.
The Apache config file contains
Listen 127.0.0.1:80
Listen trilliadin.mine.nu:80 #which is one of the virtual hosts
Listen 192.168.137.1:80 #which is Windows local address assigned to my LAN
I've tested disabling all firewalls, but no difference.
I dumped about 4MB text into a file.html to see if this also gets truncated but the whole text-file gets transferred.
Does anyone recognize these symptoms?
EDIT:
Regarding error-reporting... I do get some weird apache-errors when I start the server.
[Wed Jan 15 21:13:37.989659 2014] [mpm_winnt:notice] [pid 968:tid 424] AH00424: Parent: Received restart signal -- Restarting the server.
Failed loading D:\EasyPHP\binaries\php\php_runningversion\php_xdebug-2.2.2-5.4-vc9.dll
PHP Warning: PHP Startup: in Unknown on line 0
[Wed Jan 15 21:13:39.861663 2014] [mpm_winnt:notice] [pid 968:tid 424] AH00455: Apache/2.4.4 (Win32) PHP/5.5.0 configured -- resuming normal operations
[Wed Jan 15 21:13:39.861663 2014] [mpm_winnt:notice] [pid 968:tid 424] AH00456: Server built: Apr 8 2013 13:46:39
[Wed Jan 15 21:13:39.861663 2014] [core:notice] [pid 968:tid 424] AH00094: Command line: 'D:\\EasyPHP\\binaries\\apache\\bin\\apache.exe -d D:/EasyPHP/binaries/apache'
[Wed Jan 15 21:13:39.861663 2014] [mpm_winnt:notice] [pid 968:tid 424] AH00418: Parent: Created child process 5240
[Wed Jan 15 21:13:40.017663 2014] [mpm_winnt:notice] [pid 5328:tid 436] AH00364: Child: All worker threads have exited.
Failed loading D:\EasyPHP\binaries\php\php_runningversion\php_xdebug-2.2.2-5.4-vc9.dll
PHP Warning: PHP Startup: in Unknown on line 0
[Wed Jan 15 21:13:41.655666 2014] [mpm_winnt:notice] [pid 5240:tid 432] AH00354: Child: Starting 64 worker threads.
But I don't understand what it means. Tonight, the Virtual Host liselotte.mine.nu became unresponsive, while virtual host trilliadin.mine.nu continued working. The problem resolved when I restarted the apache server. (see error log above)

XAMPP causing 'The connection was reset' error in Firefox

I'm experiencing problems when running a specific PHP file; in the latest Firefox it keeps giving the error 'The connection was reset' (I've tried running the PHP file in a different browser - the latest Internet Explorer but get the same problem).
I've also tried completely uninstalling both XAMPP and Firefox (default browser) - then reinstalling them.
I have even tried clearing the cache in Firefox and also ran CCleaner.
I'm not sure what is causing this problem as when I run the exact PHP file on another machine (on Windows 7 - with XAMPP & latest Firefox) it works perfectly fine and it is not like the PHP file is fairly complex/resource intensive (it does not even call/use MySQL!)? :S
I have tried integrating some debug/error reporting code within the PHP file - but that does not produce/do anything, but I've noticed whenever the PHP file is ran; apache does create/update an 'error.log' file within the 'XAMPP/apache/logs' folder with the following errors:
[Tue May 28 07:31:18.158004 2013] [ssl:warn] [pid 2404:tid 328] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue May 28 07:31:18.283009 2013] [mpm_winnt:notice] [pid 2404:tid 328] AH00455: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 configured -- resuming normal operations
[Tue May 28 07:31:18.283009 2013] [mpm_winnt:notice] [pid 2404:tid 328] AH00456: Server built: Aug 18 2012 12:41:37
[Tue May 28 07:31:18.283009 2013] [core:notice] [pid 2404:tid 328] AH00094: Command line: 'c:\\users\\admin\\xampp\\apache\\bin\\httpd.exe -d C:/Users/Admin/XAMPP/apache'
[Tue May 28 07:31:18.283009 2013] [mpm_winnt:notice] [pid 2404:tid 328] AH00418: Parent: Created child process 4112
PS-1: I noticed it is referring to SSL within the above log - I'm not using SSL?.
PS-2: The XAMPP settings are exactly the same since the install (like I have not modified/updated php.ini or have added anything that does within the .htaccess file).
OS: Windows 8 (64 bit)
XAMPP: 1.8.1 (installed relatively to user 'Admin' => 'C:/Users/Admin/XAMPP')
Browsers: Latest - Firefox (default) and Internet Explorer, both have NO third-party extensions/add-ons installed/enabled
Security programs: Avira Free Antivirus, Malwarebytes Anti-Malware (PRO) and KeyScrambler (Personal)
I had what might be a similar problem a few years back, and, if I recall correctly, it was caused by using Notepad to write the script. Upon switching to another text editor the problem was fixed. As I recall, there were hidden characters inserted by Notepad (or whatever it was that I had used).

Categories