Driver = mysqli NOT working (OJS 3.2.1-1)

Hello All:

The following issue has been posted as an issue many times here, for both OJS 3.1 and 3.2.x.
E.g.:

That is the ERROR (during installation of OJS):
Call to undefined function mysql_connect()
The solutions is always given as editing “config.inc.php” and set
driver = mysqli
I did that – actually “mysqli” was already set there. I tried to install OJS 3.2.1-1 (using the original installer from the PKP website) on a Ubuntu 18.04 system with PHP 7.3 and afterwards on a CentOS 7.8 OS with 7.3 (and later 7.2), with the cPanel control panel. The mysqli module was installed in all cases:
php -m | grep -i mysqli
→ returns: mysqli
But I am still seeing that undefined function mysql_connect() ERROR, and the install never completes. I end up seeing a white page. I tried this WITH an existing empty DB and all permissions and also creating a new DB.

Since this happened on two servers with different OS, I think it must be some basic mistake. But I cannot think which that might be?

Here is the ERROR I see – I changed DB name and password for this posting:

From: /home/dyy/logs/error_log
[17-Aug-2020 20:31:35 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/dyy/public_html/lib/pkp/lib/vendor/adodb/adodb-php/drivers/adodb-mysql.inc.php:461
Stack trace:
#0 /home/dyy/public_html/lib/pkp/lib/vendor/adodb/adodb-php/adodb.inc.php(683): ADODB_mysql->_connect(‘localhost’, ‘’, ‘’, ‘’)
#1 /home/dyy/public_html/lib/pkp/classes/db/DBConnection.inc.php(162): ADOConnection->Connect(‘localhost’, ‘’, ‘’, ‘’, false)
#2 /home/dyy/public_html/lib/pkp/classes/db/DBConnection.inc.php(137): DBConnection->connect()
#3 /home/dyy/public_html/lib/pkp/classes/db/DBConnection.inc.php(124): DBConnection->initConn()
#4 /home/dyy/public_html/lib/pkp/classes/db/DBConnection.inc.php(56): DBConnection->initCustomDBConnection(‘mysql’, ‘localhost’, ‘’, ‘’, ‘’, false, ‘utf8’)
#5 /home/dyy/public_html/lib/pkp/classes/install/PKPInstall.inc.php(77): DBConnection->__construct(‘mysql’, ‘localhost’, ‘’, ‘’, ’ in /home/dyy/public_html/lib/pkp/lib/vendor/adodb/adodb-php/drivers/adodb-mysql.inc.php on line 461

Thanks for any input you may have!
Martin

Hi @martin,

Are you making this config.inc.php change before submitting the Installation form? If so, rather than doing that, make sure to choose the MySQLi driver on the database driver drop-down (instead of MySQL).

Note that the stack trace you posted includes your database credentials – I’ll remove them, but please make sure to change them (and avoid posting credentials here).

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec:
As I stated, (a) I did change the credentials in the posted error code, and (b) I did what you suggest here (and in many other postings), I did set driver = mysqli before starting the install process. That’s what I tried to explain. That setting is somehow NOT read in. I tried it multiple times, and on two different servers (all explained above).

Frank

Hi @martin,

Which database driver are you choosing in the “Database driver” section of the installation form?

image

Regards,
Alec Smecher
Public Knowledge Project Team

MySQLi – as instructed here – and in the form that is the one showing without [].

We’d be happy to share the login with you, if you want.

Hello again:

I’d like to add that the install process, before it interrupts, puts almost 5 MB of data into that prepared empty DB. It also puts files in to the [ojs]/cache folder and its sub-folders. And it creates two empty folders (journals & site) in the Directory for uploads folder outside the Web folder.

And one more piece of information:
If – instead – we use the auto-installer app “Fantastico” or (on another server) “Webuzo” (basically the same product by the same company), the install completes. However, in that case all the settings/permissions are then messed up. The main admin user has all sorts of restrictions he/she should not have, and the basic ‘roles’ are now created by default, etc., and we see all sorts of error messages when trying to do anything.emphasized text

Hi @martin,

Hmm, very odd…

There are two mechanisms currently used to connect to the database: PDO (our newer Illuminate-based toolset) and ADODB (the older database abstraction library, to be removed in a future release). The errors you’re getting relate to the ADODB toolset, but the schema creation is also done through that toolset. If the schema is being partially created before the error, then the ADODB toolset is being configured correctly.

Is there a longer stack trace of which the 5 items posted above are a subset? And just to confirm, you’re installing OJS 3.2.1-1 from the .tar.gz download on the PKP website, correct?

Regards,
Alec Smecher
Public Knowledge Project Team

Yes, correct.

Here are the error logs from another install attempt yesterday:
please have a look at the first line – maybe you have an idea how to interpret that? – That’s the main admin username for OJS referenced there.
Also – this is the COMPLETE error log for that install:

[19-Aug-2020 02:08:54 UTC] PHP Fatal error: Uncaught Exception: DB Error: Duplicate entry ‘adjournal’ for key ‘users_username’ Query: INSERT INTO users
(username, password, email, url, phone, mailing_address, billing_address, country, locales, date_last_email, date_registered, date_validated, date_last_login, must_change_password, disabled, disabled_reason, auth_id, auth_str, inline_help, gossip)
VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, null, ‘2020-08-19 02:08:54’, null, ‘2020-08-19 02:08:54’, ?, ?, ?, ?, ?, ?, ?) in /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError(Object(ADODB_mysqli), ‘INSERT INTO use…’)
#1 /home/dyy/public_html/lib/pkp/classes/user/UserDAO.inc.php(348): DAO->update(‘INSERT INTO use…’, Array)
#2 /home/dyy/public_html/lib/pkp/classes/install/PKPInstall.inc.php(252): UserDAO->insertObject(Object(User))
#3 /home/dyy/public_html/lib/pkp/classes/install/Installer.inc.php(417): PKPInstall->createData(Object(Install), Array)
#4 /ho in /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php on line 703

Hi @martin,

Are you trying to install over top of a database that’s already been populated by a failed previous installation attempt? That could be causing confusion. Make sure to drop and re-create the database between installation attempts.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec:

Sorry – yes – that was ONE of many attempts (for that one I indeed did not recreate the DB. Correct.) All other attempt, I had created a fresh empty DB with user and all privileges, though.

Just now I did a new attempt (fresh DB and user).

The “error_log” is now no more created at /home/dyy/logs/error_log but at /home/dyy/public_html/error_log – so, that’s the actual web folder. NOT sure why here now.

Also … Russian was one of several LANGUAGES I chose for the install … this RU-ru staff in the error logs is new.

[19-Aug-2020 22:29:26 UTC] PHP Fatal error:  Uncaught Exception: DB Error: Incorrect string value: '\xD0\x9D\xD0\xBE\xD0\xB2...' for column 'subject' at row 1 Query: INSERT INTO email_templates_default_data
                                                (email_key, locale, subject, body, description)
                                                VALUES
                                                ('NOTIFICATION', 'ru_RU', 'Новое уведомление с сайта «{$siteTitle}»', 'Вы получили новое уведомление с сайта «{$siteTitle}»:<br />\n<br />\n{$notificationContents}<br />\n<br />\nСсылка: {$url}<br />\n<br />\n{$principalContactSignature}', 'Это письмо отправляется зарегистрированным пользователям, которые указали, что данный тип уведомления отправляется им электронной почтой.') in /home/aca/public_html/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php(231): DAO->handleError(Object(ADODB_mysqli), 'INSERT INTO ema...')
#1 /home/dyy/public_html/lib in /home/aca/public_html/lib/pkp/classes/db/DAO.inc.php on line 703

Hi @martin,

This error:

DB Error: Incorrect string value: '\xD0\x9D\xD0\xBE\xD0\xB2...' for column 'subject' at row 1

…is related to your character set configuration. When you create your database, make sure you set its default character set to UTF8. Also ensure that the options you choose on the installation form correspond with UTF8.

Regards,
Alec Smecher
Public Knowledge Project Team

Alec, indeed! That must have been it all along. In my tests I always included Russian and Chinese. Tried yet another install now, only choosing English and German as languages, and it completed the install without any error!!!

The way I created the empty DBs was via a Web GUI – in my last tests the one that comes with the cPanel CP – just the “MySQL® Databases” creation function there (via CP). I took it for granted that the default nowadays would be UTF-8. (The mentioned Web interface has no encoding option.)

I’ll do more tests later – as regards to the DB code settings and update this ticket. Please do not close yet.
Thanks for your help, Alec.

Martin

Am happy now :slight_smile: :slight_smile: :slight_smile:
In cPanel one can change the character encoding at:
cPanel/WHM > phpMyAdmin > Select the Database > Operations > Collation > … I chose “utf8_general_ci”
Of course, that’s also possible via SSH.

Hope you don’t mind a few additional questions, all regarding install/setup – may also help others:

(1) “config.inc.php” – on a Linux system, what are the best permissions for this file? I now have it at 744 – that means: OWNER can: READ, WRITE, EXECUTE
GROUP & Others can: READ

(2) The “files_dir” entry (in the install GUI and in"config.inc.php" – it says that should be outside the Web-accessible folder. But what are the best permissions then, on a Linux system, for this folder?

(3) When trying to at a fest JOURNAL title after the setup, now having enabled about 12 languages (for test purposes), it took OJS maybe 4 minutes (!!!) to complete the “Save” process. That seems awfully long. Would it be faster without those many languages activated? (I would think it should not make a difference, but not sure.) Can you think of another typical setup mistake that would cause that? – Otherwise, “clicking around” is the install is fast!

(4) The “error_log” gets created within the Web interface of the OJS install – I find that strange. Is there any setting to choose another location.

(5) And finally, when I then tried to add a USER to that just created test journal, I received the following ERROR in a pop-up: “Failed Ajax request or invalid JSON returned.”

Best,
Martin

Wow! It does not end :slight_smile:
After getting yet another error … and finding another posting here to solve that by adding the extension (gettext) to PHP: “php73-php-gettext” – and then trying to do a new install, I get this:

[20-Aug-2020 03:39:43 UTC] PHP Warning:  session_start(): Failed to read session data: user (path: /var/cpanel/php/sessions/ea-php73) in /home/dyy/public_html/lib/pkp/classes/session/SessionManager.inc.php on line 58
[20-Aug-2020 03:39:43 UTC] PHP Fatal error:  Uncaught Exception: DB Error: Table 'dyy_jourdb.sessions' doesn't exist Query: SELECT * FROM sessions WHERE session_id = ? in /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php:703
Stack trace:
#0 /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php(103): DAO->handleError(Object(ADODB_mysqli), 'SELECT * FROM s...')
#1 /home/dyy/public_html/lib/pkp/classes/session/SessionDAO.inc.php(37): DAO->retrieve('SELECT * FROM s...', Array)
#2 /home/dyy/public_html/lib/pkp/classes/session/SessionManager.inc.php(168): SessionDAO->getSession('c16f3e43edfaeca...')
#3 [internal function]: SessionManager->read('c16f3e43edfaeca...')
#4 /home/dyy/public_html/lib/pkp/classes/session/SessionManager.inc.php(58): session_start()
#5 /home/dyy/public_html/lib/pkp/classes/session/SessionManager.inc.php(129): SessionManager->__construct(Object(SessionDAO), Object(Request))
#6 /home/dyy/public_html/lib/pkp/classes/security/Validation.inc.php(377): SessionManager::getManager()
#7 /home/dyy/public_html/lib/pkp/classes/core/PKPPageRouter in /home/dyy/public_html/lib/pkp/classes/db/DAO.inc.php on line 703

That is what I see in the error log BEFORE any installation starts, just by going to the installer page.

Hi @martin,

Is installed set to Off in your config.inc.php configuration file?

Regards,
Alec Smecher
Public Knowledge Project Team

Again thanks, Alec. That was it (the “installed” setting) – forgotten to reset that in my “reuse” of the conf file when doing another test.
Did yet another fresh test, and all works!!

LAST question as regards to ‘installation’ – I already had it posted above:
The “error_log” gets created within the Web interface of the OJS install – I find that strange. Is there any setting to choose another location for “error_log”?

Thanks!
Martin

Hi @martin,

The location of the error log is part of your PHP configuration; you’ll need to check it there.

Regards,
Alec Smecher
Public Knowledge Project Team