Skip to content
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

How to use Matomo with "ini_set" function disabled for security purposes? #14376

Closed
idevwebs opened this issue Apr 26, 2019 · 3 comments
Closed
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@idevwebs
Copy link

I have php ini_set function disabled. How can I use Matomo without it?

Error in Matomo: Matomo and Zend_Session require the ini_set() function It appears your PHP has disabled this function. To enjoy Matomo, you need remove ini_set from your disable_functions directive in php.ini, and restart your webserver.

@tsteur
Copy link
Member

tsteur commented Apr 27, 2019

You would have to enable the method.

Alternatively, the only workaround is to create a bootstrap.php and add a method like

<?php
function ini_set($name, $value){}

Haven't tested it though. For future questions please ask in our forum: https://forum.matomo.org

@tsteur tsteur closed this as completed Apr 27, 2019
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Apr 27, 2019
@idevwebs
Copy link
Author

idevwebs commented May 2, 2019

Can't do that.

PHP Fatal error: Cannot redeclare ini_set()

I don't see why the use of the function can't be controlled with an option in config like: use_iniset=true|false with a note of the expected or needed values that should be set manually by the user in their ini if set to false.

I searched through the code and the use of the function is not very many. I simply commented out this block of code in: matomo/core/testMinimumPhpVersion.php

    // if (!function_exists('ini_set')) {
    //     $piwik_errorMessage .= "<p><strong>Matomo and Zend_Session require the <code>ini_set()</code> function</strong></p>
				// 	<p>It appears your PHP has disabled this function.
				// 	To enjoy Matomo, you need remove <pre>ini_set</pre> from your <pre>disable_functions</pre> directive in php.ini, and restart your webserver.</p>";
    // }

And I was able to login and view the dashboard.

@tsteur
Copy link
Member

tsteur commented May 2, 2019

We are currently using ini_set in a lot of places and it's not just simply adding a config setting to prevent calling it, we would also need to test everything still works when ini_set is disabled, we would need to ensure nothing breaks, maintain it, etc. Plus we're using libraries that maybe do an ini_set etc. I can currently only recommend to enable the ini_set feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants