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

Enable LOAD DATA LOCAL INFILE for PHP >= 5.6.17 when mysqlnd is used. #12710

Merged
merged 2 commits into from Apr 23, 2018

Conversation

MichaelRoosz
Copy link
Contributor

The bug was fixed for mysqlnd in PHP 5.6.17, so "LOAD DATA LOCAL INFILE" can be used when mysqlnd is used and PHP => 5.6.17,

function_exists('mysqli_get_client_stats') is used to check whether mysqlnd is active.

See https://bugs.php.net/bug.php?id=68077

… See https://bugs.php.net/bug.php?id=68077

Added setting "load_data_infile_remote" to skip local file access for setups where database and webserver are not on the same system.
@MichaelRoosz
Copy link
Contributor Author

Added setting "load_data_infile_remote" to skip local file access for setups where database and webserver are not on the same system.

@mattab
Copy link
Member

mattab commented Apr 17, 2018

Thanks for the PR @MichaelHeerklotz 👍 We will review & merge it shortly.
Feedback: instead of introducing a new config file setting, we are thinking of re-using the config setting multi_server_environment=1 documented in https://matomo.org/faq/new-to-piwik/faq_134/


/*
* Second attempt: using the LOCAL keyword means the client reads the file and sends it to the server;
* the LOCAL keyword may trigger a known PHP PDO\MYSQL bug when MySQL not built with --enable-local-infile
* @see http://bugs.php.net/bug.php?id=54158
*/
$openBaseDir = ini_get('open_basedir');
$openBaseDir = !empty(ini_get('open_basedir')) && !(function_exists('mysqli_get_client_stats') && version_compare(PHP_VERSION, '5.6.17', '>='));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$openBaseDir loses its meaning when conflating open_base_dir with mysqlnd detection.

@diosmosis diosmosis self-assigned this Apr 18, 2018
@mattab mattab merged commit 93a363c into matomo-org:3.x-dev Apr 23, 2018
InfinityVoid pushed a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018
…matomo-org#12710)

* Enable LOAD DATA LOCAL INFILE for PHP >= 5.6.17 when mysqlnd is used. See https://bugs.php.net/bug.php?id=68077
Added setting "load_data_infile_remote" to skip local file access for setups where database and webserver are not on the same system.

* Switch to using multi_server_environment config and tweak boolean logic.
@MichaelRoosz MichaelRoosz deleted the fix_BatchInsert branch October 29, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants