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.
Related
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
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
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.
When I run the PHP development server, I see all request appear twice. It could be an explanation why I am having problems validating CSRF codes (they are generated twice, so the one in the form and the one finally in the session are not the same):
[Fri Mar 20 20:29:53 2020] PHP 7.4.1 Development Server (http://0.0.0.0:8080) started
[Fri Mar 20 20:30:07 2020] 127.0.0.1:51335 Accepted
[Fri Mar 20 20:30:07 2020] 127.0.0.1:51336 Accepted
[Fri Mar 20 20:30:07 2020] 127.0.0.1:51335 [200]: GET /
[Fri Mar 20 20:30:07 2020] 127.0.0.1:51335 Closing
[Fri Mar 20 20:30:07 2020] 127.0.0.1:51336 [200]: GET /
[Fri Mar 20 20:30:07 2020] 127.0.0.1:51336 Closing
Anyone an idea why this is happening?
This is how I started the server:
php -S 0.0.0.0:8080 -t public/
I checked FPM config and changed the value of servers to start to 1 (I thought it might be fpm related), but to no avail.
Mac OS X Catalina (10.15.3), PHP 7.4.1
Extra info:
created a new directory public with 1 index.php file in it containing:
hello world
<?php
file_put_contents(__DIR__ . '/../requests.log', date('Y-m-d H:i:s') . PHP_EOL, FILE_APPEND);
Running the server, and calling the page ONCE:
user#server test % php -S 0.0.0.0:8080 -t public/
[Fri Mar 20 21:04:14 2020] PHP 7.4.1 Development Server (http://0.0.0.0:8080) started
[Fri Mar 20 21:04:16 2020] 127.0.0.1:56020 Accepted
[Fri Mar 20 21:04:16 2020] 127.0.0.1:56021 Accepted
[Fri Mar 20 21:04:17 2020] 127.0.0.1:56020 [200]: GET /
[Fri Mar 20 21:04:17 2020] 127.0.0.1:56020 Closing
[Fri Mar 20 21:04:17 2020] 127.0.0.1:56021 [200]: GET /
[Fri Mar 20 21:04:17 2020] 127.0.0.1:56021 Closing
Yields this in the log:
2020-03-20 20:06:58
2020-03-20 20:06:58
processes on the laptop:
user#laptop test % ps -ef | grep php
0 163 1 0 8:25PM ?? 0:00.13 /usr/local/opt/php/sbin/php-fpm --nodaemonize
501 331 163 0 8:25PM ?? 0:00.00 /usr/local/opt/php/sbin/php-fpm --nodaemonize
501 1326 163 0 8:37PM ?? 0:00.00 /usr/local/opt/php/sbin/php-fpm --nodaemonize
Curl 0.0.0.0:8080 as #maartendev proposed yields:
[Fri Mar 20 21:09:21 2020] PHP 7.4.1 Development Server (http://0.0.0.0:8080) started
[Fri Mar 20 21:09:24 2020] 127.0.0.1:56335 Accepted
[Fri Mar 20 21:09:24 2020] 127.0.0.1:56335 [200]: GET /
[Fri Mar 20 21:09:24 2020] 127.0.0.1:56335 Closing
Thanks
Jeroen
my site is running great as it should but today i had to loggin to phpMyAdmin and i keep getting Internal Server Error.
i have chacked all permissions etc but no luck
phpMyAdmin is located in /usr/local/apache/htdocs/phpMyAdmin iam using CentOS and as webpanel CentOS WEBPANEL? any ideas what could the problem be here is my error log
[Sun Apr 05 19:24:15 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Apr 05 19:24:15 2009] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 05 19:24:15 2009] [notice] Digest: done
[Sun Apr 05 19:24:15 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Apr 05 19:26:23 2009] [notice] caught SIGTERM, shutting down
[Sun Apr 05 19:28:34 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Apr 05 19:28:34 2009] [notice] Digest: generating secret for digest authentication ...
[Sun Apr 05 19:28:34 2009] [notice] Digest: done
[Sun Apr 05 19:28:34 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Sun Apr 05 19:36:24 2009] [notice] caught SIGTERM, shutting down
[Tue Dec 30 16:39:08 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Dec 30 16:39:08 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 30 16:39:08 2014] [notice] Digest: done
[Tue Dec 30 16:39:08 2014] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Tue Dec 30 16:39:32 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:39:33 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:39:34 2014] [error] [client ip] File does not exist: /var/www/html/favicon.ico
[Tue Dec 30 16:39:36 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:39:53 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:39:57 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:39:58 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:41:25 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:50:49 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:50:52 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:50:55 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:50:57 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:51:00 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:51:06 2014] [error] [client ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:53:18 2014] [error] [client my ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:53:18 2014] [error] [client my ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:53:22 2014] [error] [client my ip] Directory index forbidden by Options directive: /var/www/html/
[Tue Dec 30 16:55:19 2014] [notice] caught SIGTERM, shutting down
[Tue Dec 30 16:55:20 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Dec 30 16:55:20 2014] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 30 16:55:20 2014] [notice] Digest: done
[Tue Dec 30 16:55:20 2014] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
[Tue Dec 30 16:56:19 2014] [notice] caught SIGTERM, shutting down
Your apache configuration is not setup to serve the php admin files.
[http://httpd.apache.org/docs/2.2/urlmapping.html][1]
Alias /usr/local/apache/htdocs/phpMyAdmin /phpMyAdmin
In a .conf file should solve the issue.
You will then be able to access it via /phpMyAdmin