• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved access system environment variables with php-fpm

jamin587

New Pleskian
I need to add env[PATH] to php-fpm pool configuration for domains which are running Nextcloud.

I added additional directives to the php-settings

Code:
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Now i need to add env[PATH] = $PATH to the pool configuration. This is not possible through the webinterface. It will give an syntax error.

I can modify the file /opt/plesk/php/7.4/etc/php-fpm.d/example.conf directly and can get rid of the warning"PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response. Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm." in Nextcloud. But as soon as i make a change in the web-interface this modification is wiped.

Code:
; ATTENTION!
;
; DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
; SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

; If you need to customize this file, use either custom PHP settings tab in
; Panel or override settings in /var/www/vhosts/system/example.com/conf/php.ini.
; To override pool configuration options, specify them in [php-fpm-pool-settings]
; section of /var/www/vhosts/system/example.com/conf/php.ini file.

[example.com]
; Don't override following options, they are relied upon by Plesk internally
prefix = /var/www/vhosts/system/$pool
user = user
group = psacln

listen = php-fpm.sock
listen.owner = root
listen.group = psaserv
listen.mode = 0660

; Following options can be overridden
chdir = /

; Uses for log facility
; If php_value[error_log] is not defined error output will be send for nginx
catch_workers_output = yes

; php.ini custom configuration directives
php_value[disable_functions] = ""
php_value[error_reporting] = 22519
php_value[max_execution_time] = 3600
php_value[max_input_time] = 3600
php_value[memory_limit] = 512M
php_value[opcache.enable_cli] = 1
php_value[opcache.interned_strings_buffer] = 8
php_value[opcache.max_accelerated_files] = 10000
php_value[opcache.memory_consumption] = 128
php_value[opcache.revalidate_freq] = 1
php_value[opcache.save_comments] = 1
php_value[open_basedir] = "/var/www/vhosts/something/:/tmp/:/dev/urandom:/proc/meminfo:/sys/class/net/venet0:/sys/class/net/lo"
php_value[post_max_size] = 10G
php_value[upload_max_filesize] = 10G

; Following directives define pool configuration
pm = ondemand
pm.max_children = 10
pm.max_spare_servers = 1
pm.min_spare_servers = 1
pm.process_idle_timeout = 10s
pm.start_servers = 1

env[PATH] = $PATH

How can i add env[PATH] in a proper/persistent way?

Overwriting it in /var/www/vhosts/system/example.com/conf/php.ini does not work
 
Last edited:
Solution:
Run
/usr/local/psa/bin/php_settings -u after changing /var/www/vhosts/system/example.com/conf/php.ini
 
Hi there!

I have the same warning message in my nextcloud installation on plesk, but the solution did not work for me.

PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response. Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.

On my plesk nextcloud installation there is no /var/www/vhosts/system/host.com/conf/php.ini file, so I created one.
But when I run the
Code:
/usr/local/psa/bin/php_settings -u
command I'm getting this errors there:

Code:
root@server:/opt/plesk/php/7.4/etc/php-fpm.d# /usr/local/psa/bin/php_settings -u

[2021-09-26 14:28:54.214] 39994:615067852a5a7 ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/phpinimng' '--virtual-host' 'host.com' '--override' '/var/www/vhosts/system/host.com/conf/php.ini' '--type' 'fpm' '--cgi-bin' '/opt/plesk/php/7.4/sbin/php-fpm' '--sysuser' 'plesk-domain-wr' '--service' 'plesk-php74-fpm' '--poold' '/opt/plesk/php/7.4/etc/php-fpm.d' '--no-reload'] with exit code [1]
phpinimng failed: configuration test '/opt/plesk/php/7.4/sbin/php-fpm --test' failed with code 78, and message:
PHP:  syntax error, unexpected TC_LABEL, expecting '=' in Unknown on line 1
[26-Sep-2021 14:28:54] ERROR: Unable to include /opt/plesk/php/7.4/etc/php-fpm.d/host.com.conf from /opt/plesk/php/7.4/etc/php-fpm.conf at line 31
[26-Sep-2021 14:28:54] ERROR: failed to load configuration file '/opt/plesk/php/7.4/etc/php-fpm.conf'
[26-Sep-2021 14:28:54] ERROR: FPM initialization failed


any suggestions??
 
I need to add env[PATH] to php-fpm pool configuration for domains which are running Nextcloud.
[...]
How can i add env[PATH] in a proper/persistent way?

Overwriting it in /var/www/vhosts/system/example.com/conf/php.ini does not work
It works if you preceed it like this:
Code:
[php-fpm-pool-settings]
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
It works if you preceed it like this:
Code:
[php-fpm-pool-settings]
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
What I meant to say is it works this way when entered directly in the webinterface's Additional configuration directives section, no need to change config files.
 
Back
Top