Modifying php.ini Has No Effect

mockingbird

Verified User
Joined
Feb 6, 2023
Messages
40
I am trying to modify certain variables. I followed the instructions here:

https://docs.directadmin.com/webservices/php/php-options.html

and created the file:
/usr/local/directadmin/data/users/username/php/domain.com.ini

(is it supposed to be "domain.com.ini or do I customize this to my own domain -- which is what I did).

Then I issued "apachectl restart". This had absolutely no effect whatsoever. My phpinfo query from my browser shows no changes.

I also tried modifying the root (global) php directives -- that had no effect.

Any help is appreciated.

Thanks
 
Not sure what your trying to accomplish, but I always use the ".user.ini" method the in root of the web site to allow users to make adjustments.
 
Not sure what your trying to accomplish, but I always use the ".user.ini" method the in root of the web site to allow users to make adjustments.
Would you elaborate please precisely on the procedure? I find Directadmin's documentation to be a little lacking.

In the meantime, I managed to find a less elegant solution than yours.

Under "/usr/local/directadmin/data/users/[username]/php"

you need to create a file:
'domain.com.ini' (obviously, replace 'domain.com' with your own domain)

just clone the contents of your global php.ini into that file, make whichever changes you want, then run:

apachectl restart

Thanks
 
You just need to make a ".user.ini" file in the web root for the user's website.

As an example for larger wordpress sites you may have:

Code:
memory_limit = 512M
post_max_size = 100M
upload_max_filesize = 100M

This file allows you to overide the defaults.

 
Forgive my ignorance -- is this also for php-fpm? Can you also confirm what you mean by web root? That can't be the public_html folder, can it? Otherwise, the user could do that themselves (which they cannot, obviously).

Also, I am having issues applying the settings. If I go into DirectAdmin and manually refresh the service, the changes take effect. How would I do this from shell?

Is it just:

apachectl restart
systemctl restart php83-fpm

this does not seem to be effective.

Thanks again
 
Yes the ".user.ini" file goes in the web root, must be spelled exactly like that, yes it starts with a period.

All my installs are php-fpm.

/home/*user*/domains/*yourdomain.com*/public_html/.user.ini

You do not need to restart anything for it to work.

File is re-read automatically periodically, so changes may take a few minutes to take effect.
 
Otherwise, the user could do that themselves (which they cannot, obviously).

Users might overwrite the file of course. To avoid it you will need to use php_admin_value in PHP-FPM config file.

- https://docs.directadmin.com/webservices/php/php-fpm.html#per-user-php-ini-settings-in-php-fpm
- https://docs.directadmin.com/webser...h-to-have-global-custom-php-fpm-configuration

Files like /usr/local/directadmin/data/users/username/php/domain.com.ini are used for fastcgi only, not PHP-FPM
 
Back
Top