Author Topic: php.ini configuration per user  (Read 47901 times)

0 Members and 2 Guests are viewing this topic.

Offline
*
php.ini configuration per user
« on: October 25, 2014, 08:22:55 PM »
you can make php.ini per user account,  user only needs is to create php.ini file and add values in it.

Location of the php.ini file is
/home/USERNAME/php.ini

How to test php.ini changes?
Simple create phpinfo.php file in the users public_html folder and add the following content in it.

Example location: /home/USERNAME/public_html/phpinfo.php
Code: [Select]
<?php
phpinfo
();
?>


Now open url in your browser (Apache restart is NOT needed):
http://your-domain.com/phpinfo.php



PHP.ini values
http://php.net/manual/en/ini.list.php
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: php.ini configuration per user
« Reply #1 on: September 25, 2015, 10:13:46 AM »
I change, in /home/username/public_html/php.ini
then i check with php.info, but the configuration not changed? how to fix it?

Offline
*
Re: php.ini configuration per user
« Reply #2 on: September 28, 2015, 05:52:51 AM »
have you checked in phpinfo() which php.ini path is loaded ?
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: php.ini configuration per user
« Reply #3 on: September 28, 2015, 08:44:26 AM »
Yes, the php path in my public html, http://domain.com/info.php, the configuration is loaded in here /home/shinoa/public_html/php.ini, i change upload max filesize , but when i login in wp-admin, i use wordpress, the configuration not change, upload file limit it's not change.

Offline
*
Re: php.ini configuration per user
« Reply #4 on: September 28, 2015, 09:12:39 PM »
Yes, the php path in my public html, http://domain.com/info.php, the configuration is loaded in here /home/shinoa/public_html/php.ini, i change upload max filesize , but when i login in wp-admin, i use wordpress, the configuration not change, upload file limit it's not change.

to make this change for wp-admin folder you should add php.ini file in wp-admin folder.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: php.ini configuration per user
« Reply #5 on: September 29, 2015, 03:10:31 AM »
Thanks, Work For me ...  ;D

Offline
**
Re: php.ini configuration per user
« Reply #6 on: December 03, 2018, 07:30:10 AM »
to make this change for wp-admin folder you should add php.ini file in wp-admin folder.

This doesn't work in CWPpro version: 0.9.8.742. Is there another method?

Offline
**
Re: php.ini configuration per user
« Reply #7 on: December 03, 2018, 07:15:56 PM »
php.ini doesn't work with php-fpm in CWPpro version: 0.9.8.741 and above. You have to change it.

from
Code: [Select]
php.ini
to
Code: [Select]
.user.ini

Offline
*
Re: php.ini configuration per user
« Reply #8 on: December 03, 2018, 09:45:12 PM »
with php-fpm you need to make a file named as ".user.ini"
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
***
Re: php.ini configuration per user
« Reply #9 on: December 31, 2018, 03:15:44 PM »
php.ini doesn't work with php-fpm in CWPpro version: 0.9.8.741 and above. You have to change it.

from
Code: [Select]
php.ini
to
Code: [Select]
.user.ini

Is local php.ini  working for a user...?

Offline
**
Re: php.ini configuration per user
« Reply #10 on: December 31, 2018, 03:45:02 PM »
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

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


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



https://stackoverflow.com/questions/27226055/does-the-user-ini-file-work-for-subdirectories

Offline
*
Re: php.ini configuration per user
« Reply #11 on: July 25, 2019, 09:44:57 AM »
Hello,
I switched from php-cgi to php-fpm and it can't read .user.ini from /home/user but /home/user/public_html only, where is .user.ini public and mixed with another files. Is possible a manual or template config to have .user.ini working from /home/user directory? Thank you.

Offline
*
Re: php.ini configuration per user
« Reply #12 on: November 20, 2020, 04:52:57 PM »
I have the same issue. I am using this guide https://wiki.centos-webpanel.com/php-open_basedir but the per user does not work.

Offline
*
Re: php.ini configuration per user
« Reply #13 on: November 21, 2020, 09:27:32 AM »
NGINX + PHP-FPM
configuration files are:
/etc/nginx/conf.d/vhosts/DOMAIN.conf
/etc/nginx/conf.d/vhosts/DOMAIN.ssl.conf

under fastcgi_param add one more line and reload/restart nginx

fastcgi_param   PHP_ADMIN_VALUE "open_basedir =/home/USERNAME:/tmp:";

** Note that manual editing of the webserver vhost files is not recommended as those files get rebuilt from the template on each change.
Try checking the instructions here for the custom template build.
http://wiki.centos-webpanel.com/webservers-vhost-templates

APACHE + PHP-FPM
Configuration files are all user existing php-fpm configuration files, to get the list of files you can use this

ls -la /opt/alt/php-fpm*/usr/etc/php-fpm.d/users/USERNAME.conf

Add at the bottom

php_admin_value[open_basedir] = /home/USERNAME:/tmp

** Note that editing any of those files requires to restart php-fpm version you edited.

** Note that manual editing of the webserver vhost files is not recommended as those files get rebuilt from the template on each change.
Try checking the instructions here for the custom template build.
http://wiki.centos-webpanel.com/webservers-vhost-templates
VPS & Dedicated server provider with included FREE Managed support for CWP.
http://www.studio4host.com/

*** Don't allow that your server or website is down, choose hosting provider with included expert managed support for your CWP.

Offline
*
Re: php.ini configuration per user
« Reply #14 on: November 21, 2020, 06:38:04 PM »
So the "correct" way to do this is to:
From cwp admin panel
webserver settings -> WebServers Template Editor -> Php-fpm
Pick a file and click clone (I picked processes-50.tpl)
name it processes-51.tpl

add to the end
Code: [Select]
php_admin_value[open_basedir] = /home/%username%:/tmp
Then go to
webserver settings -> WebServers Main conf
go to the bottom
PHP-FPM Service Configuration
Choose from PHP-FPM default template: the template you just created, ffor example processes-51.tpl

check the Rebuild all vhosts on save

click save