New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use PHP sys_temp_dir by default #10428
Conversation
This fixes a usecase when open_basedir is set, not allowing php to write to default temp directory /tmp. In that case, temp directory is set by `php_admin_value[sys_temp_dir] = /var/www/site/tmp` Without setting config['temp_dir'] in generated config.php, LibreNMS will use /tmp regardless of what is set in fpm configuration.
html/install.php
Outdated
@@ -367,6 +391,9 @@ | |||
//Please ensure this user is created and has the correct permissions to your install | |||
\$config['user'] = 'librenms'; | |||
|
|||
// This is the temporary directory used by php, set by php_admin_value[sys_temp_dir], defaults to /tmp when not set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you are adding this to the default config.php? (which I plan to remove entirely at some point)
Setting it here actually doesn't allow php_admin_value[sys_temp_dir] to set it after you have installed LibreNMS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my test setup, I've set the following:
php_admin_value[open_basedir] = /var/www/myvhost
php_admin_value[sys_temp_dir] = /var/www/myvhost/tmp
With those settings, I still get php errors saying that /tmp isn't writable, unless I set
$config['temp_dir'] = /var/www/myvhost/tmp or sys_get_temp_dir();
So this is mainly a workaround for LibreNMS not honoring the tmp dir set by php_admin_value[sys_temp_dir].
Just tried a fresh installation (without the $config['temp_dir'] patch). Here's what I get altough the following php parameters are configured:
librenms.log output:
I suppose that those temp dir php parameters are overriden somewhere so I searched via grep for "/tmp" in librenms. |
Why not just make the default setting for |
Sure, I'll check if this is working, and arrange my PR, but I'll keep the tmp dir test since it's nice to have :) |
Done, tested on my open_basedir php setup, works for me. |
This pull request has been mentioned on LibreNMS Community. There might be relevant details there: https://community.librenms.org/t/v1-55-release-changelog-august-2019/9428/1 |
@deajan not sure why that is in there, probably a rebase/merge issue. Make a new PR to fix it. |
This fixes a usecase when open_basedir is set, not allowing php to write to default temp directory /tmp.
In that case, temp directory is set by
php_admin_value[sys_temp_dir] = /var/www/site/tmp
Without setting config['temp_dir'] in generated config.php, LibreNMS will use /tmp regardless of what is set in fpm configuration.
This will set config['temp_dir'] to /tmp if not if no special sys_temp_dir directive is configured in php-fpm pool.
DO NOT DELETE THIS TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926
After you are done testing, you can remove the changes with
./scripts/github-remove
. If there are schema changes, you can ask on discord how to revert.