My problem was solved when mysqli part of php config for commandline was made equal to the one for my webserver.