Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sr57's avatar
Level 39

How to change php.ini for a project on a dev host?

After creation we can test a project by launching the server with the command : php artisan serve

phpinfo() shows (on my linux host) the file : /etc/php/7.4/cli/php.ini

But, if I'am right, phpini.is in fact a copy pf this file, copy that is created during the project creation and not the start of the server.

How can we change php.ini (not with ini_set function) without recreate the project?

Post solution note : It's a false pb, I was wrong when I wrote that the changes were not updated after restart of the server.

0 likes
7 replies
Tray2's avatar
Tray2
Best Answer
Level 73

The php.ini is not created by your project, it's installed together with the rest of the php package.

You have two php.ini files, one for the client side and one for the server side.

The one you should be editing is the one for the server side.

You can find a bit more info here

https://devanswers.co/ubuntu-php-php-ini-configuration-file/

sr57's avatar
Level 39

Hi @tray2

It was my understanding (till now), but new to Laravel , there 's something I don't understand.

As I wrote in my post, when I changed the php.ini (/etc/php/7.4/cli/php.ini) the changes are not taken in account when I reload the server (php artisan serve) but onle when I recreate a new project

Tray2's avatar

Yes since all changes to php.ini requires a restart of the server regardless if you use php artisan serve or a fully fledged webserver.

The /etc/php/7.4/cli/php.ini is most likely used with serve. While the php.ini for the server is used in apache and nginx. the CLI means client side. It might also be that it caches the php.ini file with the serve command so you might need to clear it.

sr57's avatar
Level 39

As I wrote in my post, when I changed the php.ini (/etc/php/7.4/cli/php.ini) the changes are not taken in account when I reload the server (php artisan serve)

It was late yesterday when I did this test, and I was WRONG (stopping the server - I have many with different ports), so no more pb, change in php.ini, restart the server to apply the changes works as usual :-)

Snapey's avatar

standard installation, there is NO php config within your project

Perhaps you are confused with the php available on the command line, and influenced by your terminal paths, and the php that is loaded by your webserver. These can be different and cause unusual problems when they are.

sr57's avatar
Level 39

Hi @snapey

standard installation, there is NO php config within your project

Still many things to learn/discover ...

These can be different and cause unusual problems when they are.

Probably

Perhaps you are confused ...

It's not only impression ... (see my previous answer to @tray2 )

Still many things to learn/discover ... any course / doc that explains this?

Please or to participate in this conversation.