Local PHP ini file not being read

resolved

#1

Does anyone know how CP ala WP reads the php max file upload directives? PHP 7.2 uses by default .user.ini as the local file.


#2

WP/CP don’t do anything special here - this depends on the server configuration. If you put this in a PHP file then you can see more details:

<?php phpinfo();

Don’t forget to delete this file when you’re done.


#3

Ok found it here:

https://developer.wordpress.org/reference/functions/wp_max_upload_size/

and here:

http://php.net/manual/en/function.ini-get.php


#4

I just spent alot of time manually updating all my sites running Divi so they could operate without crashing or timing out so if you want some of that info let me know. I just went into the hosting c panel and changed the settings in that panel to what Elegant Themes told me so the loading would stop crashing or timing out. Might be related to what you’re talking about.


#5

Looks like it’s a PHP FPM issue. FPM is domain based and not folder based and uses the .user.ini file to override the main php.ini. I think that the ini-get function reads the php.ini and not .user.ini. phpinfo() shows the local values I’ve set but they are not being picked up by the function. Not a huge deal as I can edit the master php.ini or use a filter or plugin.

Perhaps CP could fix the whole problem by adding an option to the settings or at least raising the max to something more reasonable in today’s high res world.


#6

Solved: When using PHP FPM you have to put the .user.ini file in the wp-admin folder.


#7

Note: the right file structure depends on your hosting provider.


#8

I am the host lol. On further research its was an Apache config error which apparently is quite common. Specifically it was a trailing slash error in the domain.ca.conf file.

/usr/local/apache/conf.d/vhosts

<IfModule proxy_fcgi_module> <FilesMatch \.php$> SetHandler "proxy:unix:/opt/alt/php-fpm73/usr/var/sockets/jet.sock|fcgi://localhost/" </FilesMatch> </IfModule>

The trailing slash after localhost breaks the recursive search at least for ClassicPress.

Source