Where php.ini is located

Post Reply
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Location of php.ini is /etc/php/X.X/fpm/php.ini
(where X.X is 7.4 for example)

To check what PHP version your site is running, in your SSH run:

Code: Select all

sudo /usr/local/vesta/bin/v-get-php-version-of-domain yourdomain.com
After you make the changes in /etc/php/X.X/fpm/php.ini , you should restart php-fpm (do it in SSH):

Code: Select all

sudo systemctl restart phpX.X-fpm
(where X.X is 7.4 for example)



Important note:
  • pm.max_children
  • memory_limit
  • max_execution_time (also consider: request_terminate_timeout)
  • upload_max_filesize
  • post_max_size
  • open_basedir
  • upload_tmp_dir
  • sendmail_path
  • mysql.allow_persistent
  • safe_mode
... are overrided in /etc/php/X.X/fpm/pool.d/yourdomain.com.conf files.
These variables you should change there.
Also restart php-fpm after those changes.

If you need different default values for newly created domains, edit /usr/local/vesta/data/templates/web/apache2/PHP-FPM-XX.sh files (where XX is 74 for example).

Additional notes:
  • Every time when you increase or decrease max_execution_time, you should also increase/decrease request_terminate_timeout.
    Variable request_terminate_timeout is given in real seconds (default value is 90s), and max_execution_time is not.
    Variable max_execution_time is measured in CPU time spent on the current process. More about this could be found here: https://stackoverflow.com/questions/100 ... 0#10027320
    What is important for us is that max_execution_time could last a lot longer than 30 seconds if some process got stuck with IO waiting. That's why request_terminate_timeout is important and would prevent a potential indefinite IO waiting.

Tags:
1webdomain
Posts: 7
Joined: Tue Sep 29, 2020 6:57 am

THX
crafter
Posts: 20
Joined: Wed Nov 10, 2021 11:43 pm

I just did a fresh install of myvesta and try to edit the php file but my php.ini file is blank. I input the desired values in basic form but it keeps erasing and I paid for the file manger addon and got it up but I still can't get to edit the /etc/php/7.3/fpm/php.ini file like you stated in this post. what am i missing please?
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

crafter wrote: Mon Nov 15, 2021 10:46 am I just did a fresh install of myvesta and try to edit the php file but my php.ini file is blank. I input the desired values in basic form but it keeps erasing and I paid for the file manger addon and got it up but I still can't get to edit the /etc/php/7.3/fpm/php.ini file like you stated in this post. what am i missing please?
FileManager can't reach /etc/php/7.3/fpm/php.ini

Please screenshot your SSH console while you are trying to edit /etc/php/7.3/fpm/php.ini
Also, please mention what Debian version you are using?
crafter
Posts: 20
Joined: Wed Nov 10, 2021 11:43 pm

I'm using Debian 10. i use Putty to access ssh as root. I'm a novice so i just copy and paste the command line you put up here and follow instructions. so i input: /etc/php/7.3/fpm/php.ini and got "-Bash: /etc/php/7.3/fpm/php.ini: Permission denied.

The problem is i want to change the Post max, max input, memory limit etc of the php 7.3 but it wasn't saving and the advance editing option only shows: "Usage: CONFIG" and nothing else but I'm familiar with editing php.ini file so i know there should be more.

Furthermore, the vesta-php configuration link takes me to a page that shows: "Page not Found"
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

crafter wrote: Mon Nov 15, 2021 11:15 am I'm using Debian 10. i use Putty to access ssh as root. I'm a novice so i just copy and paste the command line you put up here and follow instructions. so i input: /etc/php/7.3/fpm/php.ini and got "-Bash: /etc/php/7.3/fpm/php.ini: Permission denied.
In SSH type:

Code: Select all

sudo mcedit /etc/php/7.3/fpm/pool.d/your-domain.com.conf
Save with F2 keyboard key.
Exit with ESC keyboard key.

Then restart php7.3:

Code: Select all

sudo systemctl restart php7.3-fpm
Also, you cen edit php.ini by typing:

Code: Select all

sudo mcedit /etc/php/7.3/fpm/php.ini
but almost all changes you need to do in /etc/php/7.3/fpm/pool.d/YOUR-DOMAIN.COM.conf
crafter
Posts: 20
Joined: Wed Nov 10, 2021 11:43 pm

These steps worked like magic :shock: . Thank you very much and especially for how fast you responded. More codes to your brain :ugeek:
tienloc1
Posts: 27
Joined: Sun Aug 08, 2021 9:58 pm

About this part:
Additional notes:
Every time when you increase or decrease max_execution_time, you should also increase/decrease request_terminate_timeout.
Variable request_terminate_timeout is given in real seconds (default value is 90s), and max_execution_time is not.
Variable max_execution_time is measured in CPU time spent on the current process. More about this could be found here: https://stackoverflow.com/questions/100 ... 0#10027320
What is important for us is that max_execution_time could last a lot longer than 30 seconds if some process got stuck with IO waiting. That's why request_terminate_timeout is important and would prevent a potential indefinite IO waiting.
I don't have knowledge about the php value so could you help about this question:

I need to increase the max_execution_time to 300, so I will need to increase request_terminate_timeout to 300 too?
itsjaredfilm
Posts: 1
Joined: Mon May 22, 2023 7:29 am

My php.ini file is blank just says config and that is it.
Post Reply