Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Call to undefined function mysql_connect()

after a fresh install on an ubuntu 16.04 with php7.0, everything works fine excepted the "import" part of the admin board.
after activating the debug in config.php, i get this message:

Fatal Error in ImportModel.LoadTableLocalInfile();
Call to undefined function mysql_connect()
The error occurred on or near: /var/www/html/vanilla/applications/dashboard/models/class.importmodel.php
1282: lines terminated by '\n'
1283: ignore 1 lines";
1284:
1285: // We've got to use the mysql
* functions because PDO doesn't support load data local infile well.
1286: $dblink = mysql_connect(c('Database.Host'), c('Database.User'), c('Database.Password'), false, 128);
1287: mysql_select_db(c('Database.Name'), $dblink);
1288: $Result = mysql_query($Sql, $dblink);
1289: if ($Result === false) {
1290: $Ex = new Exception(mysql_error($dblink));
Backtrace:
[/var/www/html/vanilla/applications/dashboard/models/class.importmodel.php:1427] ImportModel->_LoadTableLocalInfile();
[/var/www/html/vanilla/applications/dashboard/controllers/class.importcontroller.php:202] ImportModel->loadTableType();
[/var/www/html/vanilla/library/core/class.dispatcher.php:326] ImportController->index();
[/var/www/html/vanilla/index.php:44] Gdn_Dispatcher->dispatch();
Need Help?
If you are a user of this website, you can report this message to a website administrator.
If you are an administrator of this website, you can get help at the Vanilla Community Forums.
Additional information for support personnel:
Application: Vanilla
Application Version: 2.3
PHP Version: 7.0.8-0ubuntu0.16.04.3
Operating System: Linux
Server Software: Apache/2.4.18 (Ubuntu)
Referer: http://localhost/vanilla/settings/gettingstarted
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36
Request Uri: /vanilla/dashboard/import
Controller: ImportModel
Method: _LoadTableLocalInfile

mysql_connect is a deprecated function, how to workaround this ?

Comments

  • SwennetSwennet New
    edited January 2017

    PHP7 no longer uses the mysql_connect function. Instead, it has been replaced with mysqli_connect.

    A simple solution would be to do a search and replace. Search for "mysql_connect" and replace with "mysqli_connect" in your /vanilla/applications/dashboard/models/class.importmodel.php file.

    VipulK
Sign In or Register to comment.