28

enter image description here

So I just created a new project using the command:

laravel new blog

Then I started by changing the directory and do the command

php artisan serve

And this is what happened, more details:

  1. I'm using Laravel 8.0.1
  2. I haven't run any command except the one I listed above
  3. I'm using Windows
  4. I even updated the PHP to 7.4.10

I'm not sure why this is happening, but I'm encountering an issue when using the command:

php -S localhost:8000 -t public
2
  • 3
    You don't have php.ini or not good configured. You can find the answer here Commented Dec 1, 2020 at 19:30
  • Loaded Configuration File: C:\wamp64\bin\php\php7.4.9\php.ini same problem Commented Feb 10, 2021 at 21:00

6 Answers 6

40

I had this problem too, and I solved it in this way:

set: php.ini

variables_order = "GPCS"
Sign up to request clarification or add additional context in comments.

7 Comments

I'm using Laravel Herd and its default php-ini file. Solved the issue with variables_order = "GPCS"
where did you write this? just in terminal ?
@Ahmed try to run php -i in the command line, somewhere along the first lines of the output you will see where your php.ini file is located. Open it and search for variables_order and change accordingly.
but I'm concerned if removing the "E" the environment variables from "EGPCS" is a good practice?
@OmarAbdo It would not hurt, in case of Laravel at least. Those characters stand for $_ENV, $_GET, $_POST, $_COOKIE and $_SERVER respectively. In Laravel we do not need the global variable $_ENV, because Laravel relies on the DotEnv library.
|
21

I came across the same issue. This was how how I solved mine:

  1. Goto the main PHP part, I mean the installed PHP from official website.
  2. Look out for a folder named php.ini-development
  3. Duplicate this file.
  4. Then rename the copy to php.ini
  5. Go back to your laravel project folder and rerun php artisan serve

PS: If there is any additional steps you took, you can as well comment them below: XOXO

Comments

20

You need to change the variables_order value to GPCS in php.ini file. For Herd users on Windows, here is how you can do it:

  1. Right click on Herd icon and click Open configuration files Herd Open Configuration Files

  2. Navigate to bin folder > Click on which php version you use (eg php82 or php83 > Find php.ini file. Here is usually where it sits: "C:\Users\<username>\.config\herd\bin\php82\php.ini"

  3. Open the file using text editor

  4. Find the part with variables_order and change the value to GPCS.

php.ini variables_order

  1. Save the file and retry the artisan serve command from your project

3 Comments

This solved it for me after an evening of digging. Thank you! Added this to my bookmarks
Thanks for specify steps to solve the Herd related problem
Thanks! Worked for me, perfect explanation.
6

Rather than modifying the ini file, you can use this command instead.

php -d variables_order=GPCS artisan serve

1 Comment

That worked like a charm!
4

This error is because the php.ini was not found.

run php --ini

Configuration File (php.ini) Path: Loaded Configuration File: C:\php8\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none)

The line "Loaded Configuration File" would indicate the location of loaded php.ini, if not, rename the php.ini-development to php.ini

Comments

1

Check your PHP version in your local server and System variable path. Make sure they are using the same PHP version

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.