Laravel server closes after starting it up - php

So I created a Laravel project and tried to boot it up,
however every time I do so it closes down again
Laravel development server started on http://localhost:8000
[Sat Jan 15 13:27:20 2022] PHP 7.4.27 Development Server (http://localhost:8000) started
[Sat Jan 15 13:27:42 2022] [::1]:55208 Accepted
[Sat Jan 15 13:27:42 2022] [::1]:55209 Accepted
[Sat Jan 15 13:27:42 2022] [::1]:55208 Closing
[Sat Jan 15 13:27:42 2022] [::1]:55209 [200]: GET /favicon.ico
[Sat Jan 15 13:27:42 2022] [::1]:55209 Closing
I tried changing the port to 9000 but that also didn't work
Laravel development server started on http://localhost:9000
[Sat Jan 15 13:30:02 2022] PHP 7.4.27 Development Server (http://localhost:9000) started
[Sat Jan 15 13:30:16 2022] [::1]:54118 Accepted
[Sat Jan 15 13:30:16 2022] [::1]:54119 Accepted
[Sat Jan 15 13:30:16 2022] [::1]:54118 Closing
[Sat Jan 15 13:30:17 2022] [::1]:54119 [200]: GET /favicon.ico
[Sat Jan 15 13:30:17 2022] [::1]:54119 Closing
[Sat Jan 15 13:30:19 2022] [::1]:54125 Accepted
[Sat Jan 15 13:30:19 2022] [::1]:54126 Accepted
[Sat Jan 15 13:30:19 2022] [::1]:54125 Closing
[Sat Jan 15 13:30:20 2022] [::1]:54126 [200]: GET /favicon.ico
[Sat Jan 15 13:30:20 2022] [::1]:54126 Closing
does anyone know what's happening here?

That is not a problem, it's working fine. By the closing in logs, it means it's closing the specific connection.
Here's a log from my laravel install

Related

VSCode php server [404] / - No such file or directory problem

I have installed php server on my vscode with a proper php server from php.net used at $PATH
But when I try to press
PHP Server: Serve project
I get the following error:
[Tue Oct 25 21:30:53 2022] PHP 8.1.11 Development Server (http://localhost:3000) started
[Tue Oct 25 21:34:55 2022] [::1]:62162 Accepted
[Tue Oct 25 21:34:55 2022] [::1]:62163 Accepted
[Tue Oct 25 19:34:55 2022] [404] / - No such file or directory
[Tue Oct 25 21:34:55 2022] [::1]:62163 [404]: GET / - No such file or directory
[Tue Oct 25 21:34:55 2022] [::1]:62163 Closing
[Tue Oct 25 21:36:07 2022] [::1]:62162 Closed without sending a request; it was probably just an unused speculative preconnection
[Tue Oct 25 21:36:07 2022] [::1]:62162 Closing

How to stop php-cli-server's request logging

I am using php 7.4 and I am trying to built a local devserver with php-cli
I can log requests in my routing file but php-server always logs requests like;
[Fri Jun 25 12:49:59 2021] PHP 7.4.20 Development Server (http://localhost:8100) started
[Fri Jun 25 12:50:01 2021] [::1]:51057 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51058 Accepted
[Fri Jun 25 12:50:01 2021] Connection: ::1:51058 [200]: /
[Fri Jun 25 12:50:01 2021] [::1]:51058 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51059 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51060 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51061 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51062 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51063 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51064 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51059 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51060 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51061 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51062 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51063 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51065 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51064 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51066 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51065 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51067 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51066 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51068 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51069 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51067 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51068 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51069 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51070 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51071 Accepted
[Fri Jun 25 12:50:01 2021] [::1]:51070 Closing
[Fri Jun 25 12:50:01 2021] [::1]:51071 Closing
[Fri Jun 25 12:51:01 2021] [::1]:51057 Closed without sending a request; it was probably just an unused speculative preconnection
[Fri Jun 25 12:51:01 2021] [::1]:51057 Closing
The [Fri Jun 25 12:50:01 2021] Connection: ::1:51058 [200]: / part is logged by the router.
how can I close other logs? please help me.
Once I have read about starting php server in silent mode. I guess we can use -q flag to avoid request logging which comes by php-fpm.
I am starting my server with a little function like;
function start() {
exec("php -S address:port .router.php")
}
And if I want to use quiet mode I need to add -q flag in this function.
Like;
function start() {
exec("php -q -S address:port .router.php")
}
This not solves my problem. Actually this kills every error_log() function. Please find another solution.

Yii2 view is not rendered. Returns to home view

So I am trying to make a simple register form while I follow this specific guide: https://youtu.be/sRJ6GYiCwkI?t=3122
My problem is that ANY redirect I try to make does not work as intended.
For example, if I need to move to gii my URL must be :
> http://localhost:8080/index.php?r=gii%2Fdefault%2Findex
Instead of
> http://localhost:8080/gii
I am using OSX Big Sur and MAMP. Maybe I need to configure something differently?
My log on my terminal when I try to access signup:
> [Wed Dec 9 13:33:22 2020] [::1]:51857 [200]: /signup
[Wed Dec 9 13:33:22 2020] [::1]:51858 [200]: /assets/c2edef5c/jquery.js
[Wed Dec 9 13:33:22 2020] [::1]:51859 [200]: /assets/1e2a1c44/yii.js
[Wed Dec 9 13:33:22 2020] [::1]:51860 [200]: /assets/a6d39922/js/bootstrap.js
[Wed Dec 9 13:33:22 2020] [::1]:51861 [200]: /assets/a6d39922/css/bootstrap.css
[Wed Dec 9 13:33:22 2020] [::1]:51862 [200]: /css/site.css
[Wed Dec 9 13:33:22 2020] [::1]:51863 [200]: /index.php?r=debug%2Fdefault%2Ftoolbar&tag=5fd0b60224015
When I do the same on XAMPP on Windows 10:
> Quit the server with CTRL-C or COMMAND-C.
[Wed Dec 9 13:33:59 2020] PHP 7.4.9 Development Server (http://localhost:8080) started
[Wed Dec 9 13:34:07 2020] [::1]:63263 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63263 [200]: GET /signup
[Wed Dec 9 13:34:07 2020] [::1]:63263 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63264 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63265 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63264 [200]: GET /assets/1f96f9b3/jquery.js
[Wed Dec 9 13:34:07 2020] [::1]:63266 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63265 [200]: GET /assets/87550bf1/yii.js
[Wed Dec 9 13:34:07 2020] [::1]:63267 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63266 [200]: GET /assets/cb962770/js/bootstrap.js
[Wed Dec 9 13:34:07 2020] [::1]:63268 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63267 [200]: GET /assets/cb962770/css/bootstrap.css
[Wed Dec 9 13:34:07 2020] [::1]:63268 [200]: GET /css/site.css
[Wed Dec 9 13:34:07 2020] [::1]:63265 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63264 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63266 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63267 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63268 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63269 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63269 [200]: GET /index.php?r=debug%2Fdefault%2Ftoolbar&tag=5fd0b62fa5773
[Wed Dec 9 13:34:07 2020] [::1]:63269 Closing
[Wed Dec 9 13:34:07 2020] [::1]:63270 Accepted
[Wed Dec 9 13:34:07 2020] [::1]:63270 Closed without sending a request; it was probably just an unused speculative preconnection
[Wed Dec 9 13:34:07 2020] [::1]:63270 Closing
My actual script (like the one on the video):
public function actionSignUp()
{
$model = new SignupForm();
//POST DATA
//PUT INSIDE THE MODEL BASED ON THE RULES OF THE SIGNUP FORM
if($model->load(Yii::$app->request->post()) && $model->signup()){
return $this->redirect(Yii::$app->homeUrl) ;
}
return $this->render('signup', [
'model' => $model
]);
}
For using "pretty" urls you should configure your component urlManager config, just search for it in your configuration file (config/web.php on yii2-basic).
Your configuration should be something like this:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true, // This must be true
'showScriptName' => false,
'rules' => [
],
],
Also, you need to make shure that your app server (Apache) can handle those requests.
Read more on the Yii2 oficial docs: https://www.yiiframework.com/doc/guide/2.0/en/runtime-routing#using-pretty-urls
#bpanatta was correct!
The name was wrong.

Chromium problems with MP4 and PNG only when HTML runs on PHP server

My page index.html is working completely fine if I open it directly with Chromium. MP4 videos load properly
and PNG images (ticks) which are set as a background for checkboxes display nicely.
Because this isn't ran on a PHP server it is normal that when I click a form submit button, my PHP script downloads instead of being ran.
So I now start my PHP portable server which I have localy installed on my PC like this:
php -S localhost:1337 -t ~/Dropbox/internet/linux_krozki/
And now I use Chromium to open my page on PHP server by inputing the link:
http://localhost:1337/index.html
In general my page is now taking too long to load and all of a suden MP4 videos won't open and neither will PNG images. When I press submit form, Chromium just starts to refresh and it never stops nor does it finish...
I am on Arch Linux and if I check my version with uname -a I get:
Linux ziga-laptop 4.11.9-1-ARCH #1 SMP PREEMPT Wed Jul 5 18:23:08 CEST 2017 x86_64 GNU/Linux
My Chromium version can be checked with pacman -Qi chromium which returns:
Name : chromium
Version : 60.0.3112.90-1
Description : A web browser built for speed, simplicity, and security
Architecture : x86_64
URL : https://www.chromium.org/Home
Licenses : BSD
Groups : None
Provides : None
Depends On : gtk3 nss alsa-lib xdg-utils libxss libcups libgcrypt ttf-font systemd dbus libpulse pciutils json-glib
desktop-file-utils hicolor-icon-theme flac opus minizip libpng harfbuzz-icu libxslt re2 libwebp libjpeg
snappy
Optional Deps : pepper-flash: support for Flash content [installed]
kdialog: needed for file dialogs in KDE
gnome-keyring: for storing passwords in GNOME keyring
kwallet: for storing passwords in KWallet [installed]
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 207.40 MiB
Packager : Evangelos Foutras <evangelos#foutrelis.com>
Build Date : Thu 03 Aug 2017 06:28:09 AM CEST
Install Date : Mon 07 Aug 2017 01:15:39 AM CEST
Install Reason : Explicitly installed
Install Script : Yes
Validated By : Signature
No error is printed in terminal window in which I started the PHP. This is all I get after 1st opening the page, 2nd try to open a video and 3rd try to fill out the form and send it:
[ziga#ziga-laptop ~]$ php -S localhost:1337 -t ~/Dropbox/internet/linux_krozki/
PHP 7.1.8 Development Server started at Mon Aug 7 02:35:01 2017
Listening on http://localhost:1337
Document root is /home/ziga/Dropbox/internet/linux_krozki
Press Ctrl-C to quit.
[Mon Aug 7 02:35:11 2017] ::1:44228 [200]: /index.html
[Mon Aug 7 02:35:11 2017] ::1:44230 [200]: /js/jquery-3.2.1.min.js
[Mon Aug 7 02:35:11 2017] ::1:44232 [200]: /js/mathjax-2.7.1/MathJax.js?config=default
[Mon Aug 7 02:35:11 2017] ::1:44234 [200]: /css/style.css
[Mon Aug 7 02:35:11 2017] ::1:44236 [200]: /css/modal.css
[Mon Aug 7 02:35:11 2017] ::1:44238 [200]: /slike/logotip/logotip.png
[Mon Aug 7 02:35:11 2017] ::1:44240 [200]: /slike/linux-c-arm/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44242 [200]: /slike/linux-eda-cad/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44244 [200]: /slike/linux-blender/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44246 [200]: /slike/linux-photo/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44248 [200]: /slike/linux-audio/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44250 [200]: /slike/linux-latex/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44252 [200]: /slike/linux-desktop/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44254 [200]: /slike/linux-office/prikazna/003-prikazna-small.jpg
[Mon Aug 7 02:35:11 2017] ::1:44256 [200]: /js/mathjax-2.7.1/config/default.js?V=2.7.1
[Mon Aug 7 02:35:11 2017] ::1:44258 [200]: /slike/wallpaper/005.gif
[Mon Aug 7 02:35:11 2017] ::1:44260 [200]: /fonts/alegreya-sans-b1.ttf
[Mon Aug 7 02:35:11 2017] ::1:44262 [200]: /fonts/alegreya-sans-b3.ttf
[Mon Aug 7 02:35:11 2017] ::1:44264 [200]: /fonts/fontawesome.ttf
[Mon Aug 7 02:35:11 2017] ::1:44266 [200]: /fonts/alegreya-sans-b2.ttf
[Mon Aug 7 02:35:11 2017] ::1:44268 [200]: /fonts/garamond.ttf
[Mon Aug 7 02:35:11 2017] ::1:44270 [200]: /slike/kontaktni-obrazec/001.gif
[Mon Aug 7 02:35:11 2017] ::1:44272 [200]: /slike/prijavni-obrazec/006.jpg
[Mon Aug 7 02:35:11 2017] ::1:44274 [200]: /slike/prijavni-obrazec/selectbox-button.png
[Mon Aug 7 02:35:11 2017] ::1:44276 [200]: /video/test.mp4
[Mon Aug 7 02:35:11 2017] ::1:44278 [200]: /video/test.mp4
[Mon Aug 7 02:35:11 2017] ::1:44280 [200]: /video/test.mp4
[Mon Aug 7 02:35:11 2017] ::1:44282 [200]: /video/test.mp4
[Mon Aug 7 02:35:11 2017] ::1:44284 [200]: /video/test.mp4
[Mon Aug 7 02:35:11 2017] ::1:44286 [200]: /video/test.mp4
[Mon Aug 7 02:35:12 2017] ::1:44288 [200]: /video/test.mp4
[Mon Aug 7 02:35:12 2017] ::1:44290 [200]: /video/test.mp4
[Mon Aug 7 02:35:12 2017] ::1:44292 [200]: /video/test.mp4
[Mon Aug 7 02:35:12 2017] ::1:44294 [200]: /js/mathjax-2.7.1/jax/input/TeX/config.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44296 [200]: /js/mathjax-2.7.1/jax/output/HTML-CSS/config.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44298 [200]: /js/mathjax-2.7.1/extensions/tex2jax.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44300 [200]: /js/mathjax-2.7.1/jax/element/mml/jax.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44302 [200]: /js/mathjax-2.7.1/jax/input/TeX/jax.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44304 [200]: /js/mathjax-2.7.1/jax/output/HTML-CSS/jax.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44306 [200]: /js/mathjax-2.7.1/jax/output/HTML-CSS/fonts/TeX/fontdata.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44308 [200]: /js/mathjax-2.7.1/extensions/MathEvents.js?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44310 [200]: /js/mathjax-2.7.1/fonts/HTML-CSS/TeX/woff/MathJax_Main-Regular.woff?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44312 [200]: /js/mathjax-2.7.1/fonts/HTML-CSS/TeX/woff/MathJax_Math-Italic.woff?V=2.7.1
[Mon Aug 7 02:35:12 2017] ::1:44314 [200]: /js/mathjax-2.7.1/fonts/HTML-CSS/TeX/woff/MathJax_Size1-Regular.woff?V=2.7.1
[Mon Aug 7 02:35:13 2017] ::1:44316 [200]: /js/mathjax-2.7.1/extensions/TeX/AMSmath.js?V=2.7.1
[Mon Aug 7 02:35:13 2017] ::1:44320 [200]: /js/mathjax-2.7.1/fonts/HTML-CSS/TeX/woff/MathJax_Size2-Regular.woff?V=2.7.1
[Mon Aug 7 02:35:13 2017] ::1:44322 [200]: /video/test.mp4
[Mon Aug 7 02:35:13 2017] ::1:44324 [200]: /video/test.mp4
[Mon Aug 7 02:35:13 2017] ::1:44326 [200]: /video/test.mp4
[Mon Aug 7 02:35:14 2017] ::1:44328 [200]: /video/test.mp4
[Mon Aug 7 02:35:14 2017] ::1:44330 [200]: /video/test.mp4
[Mon Aug 7 02:35:14 2017] ::1:44332 [200]: /video/test.mp4
I don't really know what to do. If I open my page that runs on PHP server with Firefox 54.0.1-1 everything works completely fine. With Opera 46.0 I can't play MP4 videos as there are no propietary drivers installed so this is supposed to be normal, while everything else works. If I open the page with Qupzilla 2.1.2, which is a derivative from Chromium MP4 videos work fine, but PNG images don't and I can't submit the form.
I really don't know how to continue... I need suggestions...
As sugested I am adding screenshot of Chromium's network window as soon after page loads and I press the checkbox. It looks like test.mp4 videos are preloaded except for one which is pending forever. When I click on a checkbox image selectbox-kljukica.png also tries to load but it is pending forever too.
When in am Chromium network view and I click on the pending item selectbox-kljukica.png I get this info:
When I click on pending item test.mp4 I get this instead:
I figured one more symptom. If I make haste and click the checkbox before MP$ videos start to load, selectbox-kljukica.png gets loaded and then works withouth any problem, so the real problem must lie in MP4...

laravel: cannot type in console after starting a server

I have recently started studying Laravel and I noticed that after I start a server (php artisan serve) I can no longer type anything in the console and I have to close and reopen it to be able to type again.
Here is what is written in the console:
C:\Xampp\Xampp\htdocs\telerikFifthHomework>php artisan controller:make UserContr
oller
Controller created successfully!
C:\Xampp\Xampp\htdocs\telerikFifthHomework>php artisan serve
Laravel development server started on http:// localhost:8000
[Tue Dec 09 22:51:15 2014] ::1:5013 [200]: /favicon.ico
[Tue Dec 09 22:51:23 2014] ::1:5042 [200]: /favicon.ico
[Tue Dec 09 22:51:39 2014] ::1:5096 [200]: /favicon.ico
[Tue Dec 09 22:51:54 2014] ::1:5140 [200]: /favicon.ico
[Tue Dec 09 22:52:35 2014] ::1:5260 [200]: /favicon.ico
[Tue Dec 09 22:52:37 2014] ::1:5266 [200]: /favicon.ico
[Tue Dec 09 22:52:37 2014] ::1:5272 [200]: /favicon.ico
[Tue Dec 09 22:52:37 2014] ::1:5274 [200]: /favicon.ico
[Tue Dec 09 22:52:38 2014] ::1:5280 [200]: /favicon.ico
[Tue Dec 09 22:52:38 2014] ::1:5283 [200]: /favicon.ico
[Tue Dec 09 22:52:57 2014] ::1:5339 [200]: /favicon.ico
[Tue Dec 09 22:53:01 2014] ::1:5350 [200]: /favicon.ico
[Tue Dec 09 22:54:07 2014] ::1:5574 [200]: /favicon.ico
[Tue Dec 09 22:54:12 2014] ::1:5590 [200]: /favicon.ico
Any suggestions?
CTRL+C will exit serve and return to prompt. Execute what you need and then serve again.
if you just started with laravel, i'd suggest to setup homestead first. This is a better way to work since you dont have to worry about server maintanance anymore and you can just focus on making a website.
This will also resolve this problem, since you use a vm to handle the server.
For more info about homestead, here are some links:
http://laravel.com/docs/4.2/homestead
https://laracasts.com/lessons/say-hello-to-laravel-homestead-two

Categories