PDO error on CSV Import?

Hello,
I’m writing due a strange error I’ve never had while working with CSV Import. Some issues with the PDO lib, so in DriverManager.php it stops working (line 246) while trying to import the csv and create the items. Did anyone ever had similar errors with OmekaS?
Here the log:

thrown in /home/username/public_html/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 246

[16-Dec-2021 12:19:24 UTC] PHP Fatal error:  Uncaught Error: Class "PDO" not found in /home/username/public_html/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php:246

Stack trace:

#0 /home/username/public_html/omeka-s/application/src/Service/ConnectionFactory.php(40): Doctrine\DBAL\DriverManager::getConnection(Array)

#1 /home/username/public_html/omeka-s/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(765): Omeka\Service\ConnectionFactory->__invoke(Object(Laminas\ServiceManager\ServiceManager), 'Omeka\\Connectio...', NULL)

#2 /home/username/public_html/omeka-s/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(201): Laminas\ServiceManager\ServiceManager->doCreate('Omeka\\Connectio...')

#3 /home/username/public_html/omeka-s/application/src/Service/ModuleManagerFactory.php(31): Laminas\ServiceManager\ServiceManager->get('Omeka\\Connectio...')

#4 /home/username/public_html/omeka-s/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(765): Omeka\Service\ModuleManagerFactory->__invoke(Object(Laminas\ServiceManager\ServiceManager), 'Omeka\\ModuleMan...', NULL)

#5 /home/username/public_html/omeka-s/vendor/laminas/laminas-servicemanager/src/ServiceManager.php(201): Laminas\ServiceManager\ServiceManager->doCreate('Omeka\\ModuleMan...')

#6 /home/username/public_html/omeka-s/application/src/Mvc/Application.php(32): Laminas\ServiceManager\ServiceManager->get('Omeka\\ModuleMan...')

#7 /home/username/public_html/omeka-s/application/data/scripts/perform-job.php(9): Omeka\Mvc\Application::init(Array)

#8 {main}

  thrown in /home/username/public_html/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 246

I’ve seen that the PDO library is called, but apparently the array of required libraries empties itselfs and returns null. Either it is an issue with my hosting service or I’ve to change something or some permissions (I apologize for possible errors in the description but I have only recently started studying back end). Thank you in advance!

PDO not found, well that would certainly be a problem.

PDO is required for Omeka S to run at all, so you almost certainly have it installed. The problem here is likely to be with the PHP command that runs to run the import in the background: either there’s some configuration problem there, or maybe more likely, there’s a different “php” command that corresponds with the version you’re actually using, and you need to be using that command.

You probably want to just check with your host in any case.

Ok so:
I created a phpinfo file, PDO is active:

PDO

PDO support enabled
PDO drivers mysql, sqlite

pdo_mysql

PDO Driver for MySQL enabled
Client API version mysqlnd 5.0.12-dev […]
Directive Local Value Master Value
pdo_mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock

pdo_sqlite

PDO Driver for SQLite 3.x enabled
SQLite Library 3.7.17

If it’s likely that the php command is wrong (the version is the one i posted above) where should I look to correct this error? Thank you again for your help

If you didn’t have PDO at all, Omeka S couldn’t run.

What’s probably happening (though this is just a guess) is that the PHP being used for the web,and therefore your phpinfo file, is fine, and it’s the php that runs on your server command line that’s an issue. If you have SSH access you can look to see what you get from running php -v (version number), php -m (lists active modules), and/or php -i (lists information equivalent to phpinfo, this will be a lot of info).

Ok so PDO is active:


php -v:
PHP 8.0.13 (cli) (built: Dec 8 2021 05:10:10) ( NTS )
php -m:

PDO
pdo_mysql
pdo_pgsql
pdo_sqlite

php -i | grep PDO

PDO
PDO support => enabled
PDO drivers => mysql, pgsql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for PostgreSQL => enabled
PDO Driver for SQLite 3.x => enabled

Is there someway to test CSV Import from command line? Or some possible denied permissions to background actions?
Could be also an issue with user bin impersonated by background processes?

Also: I activated development logging,

2021-12-20T15:55:30+00:00 ERR (3): Error: Class 'no\Module' not found in /home/astorion/public_html/omeka-s/application/src/Module/Manager.php:368
Stack trace:
#0 /home/astorion/public_html/omeka-s/application/src/Module/Manager.php(239): Omeka\Module\Manager->getModuleObject(Object(Omeka\Module\Module))
#1 /home/astorion/public_html/omeka-s/application/src/Controller/Admin/ModuleController.php(117): Omeka\Module\Manager->install(Object(Omeka\Module\Module))
#2 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Omeka\Controller\Admin\ModuleController->installAction()
#3 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))
#4 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
#5 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))
#6 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))
#7 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))
#8 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))
#9 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))
#10 /home/astorion/public_html/omeka-s/index.php(21): Laminas\Mvc\Application->run()
#11 {main} {"userId":1}

We can’t understand the error log. What is no\Module?

What were you doing to get that last error message. It says you were trying install a module. A module named “no”? Or in a folder named “no”? Something’s odd there but I want to say it’s unrelated.

Other things to check on your previous issue: what does which php return, and do you have anything set in your config/local.config.php file to set a specific path for a PHP binary to run background jobs?

This is my cli local config section in Omeka S:

'cli' => [
        'phpcli_path' => null,

which php returns:

`urs/local/bin/php

The last error was inside application.log after assistance from the hosting tried using instead of null to put /bin/sp-php, but it just returns another error which is:
Fatal error: Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type array|string, int given in /home/astorion/public_html/omeka-s/modules/Log/src/Formatter/PsrLogSimple.php:45 Stack trace: #0 /home/astorion/public_html/omeka-s/modules/Log/src/Formatter/PsrLogSimple.php(45): str_replace(‘%priority%’, 3, ‘2021-12-21T11:4…’) #1 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-log/src/Writer/Stream.php(114): Log\Formatter\PsrLogSimple->format(Array) #2 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-log/src/Writer/AbstractWriter.php(282): Laminas\Log\Writer\Stream->doWrite(Array) #3 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-log/src/Logger.php(459): Laminas\Log\Writer\AbstractWriter->write(Array) #4 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-log/src/Logger.php(502): Laminas\Log\Logger->log(3, ‘TypeError: str_…’, Array) #5 /home/astorion/public_html/omeka-s/application/src/Mvc/ExceptionListener.php(54): Laminas\Log\Logger->err(‘TypeError: str_…’) #6 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Omeka\Mvc\ExceptionListener->handleException(Object(Laminas\Mvc\MvcEvent)) #7 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(170): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent)) #8 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(153): Laminas\EventManager\EventManager->triggerEvent(Object(Laminas\Mvc\MvcEvent)) #9 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent)) #10 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure)) #11 /home/astorion/public_html/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent)) #12 /home/astorion/public_html/omeka-s/index.php(21): Laminas\Mvc\Application->run() #13 {main} thrown in /home/astorion/public_html/omeka-s/modules/Log/src/Formatter/PsrLogSimple.php on line 45

You might try setting '/usr/local/bin/php' as the phpcli_path there, in place of what’s null now. Just to explicitly set it to the same thing that you’re running when you ssh in.

That Log error is a different thing entirely… it might be worth disabling the Log module if that problem persists as that could be a problem with the Log module specifically.

Warning : realpath(): open_basedir restriction in effect. File(/usr/local/bin/php) is not within the allowed path(s): (/home/astorion/:/opt/cpanel/ea-php73/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions:/usr/local/bin/wp) in /home/astorion/public_html/omeka-s/application/src/Stdlib/Cli.php on line 53
Tried with usr/local/bin/php. Is this some issue with the hosting?

I searched for possible solution and one was to change open_basedir restriction to none.
It was not possible to change it due to security if not for a brief period of time, so I tried with ‘/usr/local/bin/php’ as clipath again and open_basedir to none: the new error is

No input file specified.

So I guess the issue is not there necessarily.
I tried with cli_path to null also and it doesn’t work.
I think I’m hitting some wall at this point

Small new progress:
The API works just fine in my case instead of CSV Import, but I’ve noticed that batch actions such as “delete all” don’t work and give the same error as CSV Import.

Warning : realpath(): open_basedir restriction in effect. File(/usr/local/bin/php) is not within the allowed path(s): (/home/astorion/:/opt/cpanel/ea-php73/root/usr:/usr/local/lib/php:/tmp:/etc/pki/tls/certs/ca-bundle.crt:/var/cpanel/php/sessions:/usr/local/bin/wp) in /home/astorion/public_html/omeka-s/application/src/Stdlib/Cli.php on line 53

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.