Getting CSV import to work on MAMP environment fails with database connection


I have a local setup of Omeka S running on a Mac with MAMP environment. I have managed to get it working with connecting to database, adding new items, creating thubmnails, displaying pages, etc. However I encountered when running CSV import module. I can articulate all the mapping but when I start the job, I get a “starting status” that doesn’t move.
Looking around the forums I followed the suggestion from this thread: CSV Import Jobs never starts
and ran a

php application/data/scripts/perform-job.php --job-id [insert job ID here] --base-path /

from the root of my Omeka-S and got this error:

Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) in /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
Stack trace:
#0 /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(27): PDO->__construct('mysql:host=loca...', 'root', 'root', Array)
#1 /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(22): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=loca...', 'root', 'root', Array)
#2 /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(356): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(Array, 'root', 'root', Array)
#3 /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(891): Doctrine\DBAL\Connection->connect()
#4 /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(718): in /Applications/MAMP/htdocs/omeka-s/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 93

After doing some more reading, I was looking at my database ini and local.config.php file and if it is configured as follows (added the unix_socket and phpcli_path)

user     = 'root'
password = 'root'
dbname   = 'omeka'
host     = 'localhost'
port     = 8889;
unix_socket = '/Applications/MAMP/tmp/mysql/mysql.sock'
;log_path =
return [
    'logger' => [
        'log' => true,
        'priority' => \Zend\Log\Logger::NOTICE,
    'http_client' => [
        'sslcapath' => null,
        'sslcafile' => null,
    'cli' => [
        'phpcli_path' => '/Applications/MAMP/bin/php/php7.4.2/bin',
    'thumbnails' => [
        'types' => [
            'large' => ['constraint' => 800],
            'medium' => ['constraint' => 200],
            'square' => ['constraint' => 200],
        'thumbnailer_options' => [
            'imagemagick_dir' => '/usr/local/bin',
    'translator' => [
        'locale' => 'en_US',
    'service_manager' => [
        'aliases' => [
            'Omeka\File\Store' => 'Omeka\File\Store\Local',
            'Omeka\File\Thumbnailer' => 'Omeka\File\Thumbnailer\ImageMagick',

After this the job says it is in progress, but the error from the command line instruction is now:

Fatal error: Uncaught Zend\Db\Adapter\Exception\InvalidConnectionParametersException: Ambiguous connection parameters, both hostname and unix_socket parameters were set in /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php:219
Stack trace:
#0 /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php(255): Zend\Db\Adapter\Driver\Pdo\Connection->connect()
#1 /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-db/src/Adapter/Adapter.php(192): Zend\Db\Adapter\Driver\Pdo\Pdo->createStatement('INSERT INTO `lo...')
#2 /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-log/src/Writer/Db.php(128): Zend\Db\Adapter\Adapter->query('INSERT INTO `lo...')
#3 /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-log/src/Writer/AbstractWriter.php(283): Zend\Log\Writer\Db->doWrite(Array)
#4 /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-log/src/Logger.php(460): Zend\Log\Writer\AbstractWriter->write(Array)
#5 /Applicatio in /Applications/MAMP/htdocs/omeka-s/vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php on line 219

I am not sure where the problem is, in terms of permissions of running such a batch script on the omeka database?
the MAMP set up is as follows

MySQL can be administered with phpMyAdmin.

To connect to the MySQL server from your own scripts use the following connection parameters:

Host	localhost
Port	8889
User	root
Password	root
Socket	/Applications/MAMP/tmp/mysql/mysql.sock

System	Darwin Sanjins-MacBook-Pro.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Build Date	Feb 17 2020 12:49:52
Configure Command	'./configure' '--with-apxs2=/Applications/MAMP/Library/bin/apxs' '--with-zlib' '--with-zlib-dir=/Applications/MAMP/Library' '--prefix=/Applications/MAMP/bin/php/php7.4.2' '--exec-prefix=/Applications/MAMP/bin/php/php7.4.2' '--sysconfdir=/Applications/MAMP/bin/php/php7.4.2/conf' '--with-config-file-path=/Applications/MAMP/bin/php/php7.4.2/conf' '--enable-ftp' '--with-bz2=/Applications/MAMP/Library' '--with-mysqli=mysqlnd' '--enable-mbstring=all' '--with-curl=/Applications/MAMP/Library' '--enable-sockets' '--enable-bcmath' '--enable-soap' '--enable-calendar' '--with-pgsql=shared,/Applications/MAMP/Library/pg' '--enable-exif' '--with-gettext=shared,/Applications/MAMP/Library' '--with-xsl=/Applications/MAMP/Library' '--with-pdo-mysql=mysqlnd' '--with-pdo-pgsql=shared,/Applications/MAMP/Library/pg' '--with-openssl=/Applications/MAMP/Library' '--with-iconv=/Applications/MAMP/Library' '--enable-opcache' '--enable-intl' '--with-tidy=shared,/Applications/MAMP/Library' '--with-readline' '--with-mhash' '--with-iconv-dir=/Applications/MAMP/Library' '--with-sodium=/Applications/MAMP/Library' '--with-password-argon2=/Applications/MAMP/Library' '--disable-cgi' '--with-zip' '--with-kerberos' '--with-pdo-sqlite' '--with-sqlite3' '--with-imap=shared,/Applications/MAMP/Library/lib/imap-2007f/lib' '--with-imap-ssl=/Applications/MAMP/Library' '--disable-phpdbg' '--enable-gd' '--with-jpeg' '--with-freetype' '--with-pear' '--with-xmlrpc' 'KERBEROS_CFLAGS=-I/usr/include' 'KERBEROS_LIBS=-lkrb5' 'SQLITE_CFLAGS= ' 'SQLITE_LIBS=-lsqlite3' 'JPEG_CFLAGS= ' 'JPEG_LIBS=-ljpeg' 'SASL_CFLAGS=-I/usr/include/sasl' 'SASL_LIBS=-lsasl2'
Server API	Apache 2.0 Handler
Virtual Directory Support	disabled
Configuration File (php.ini) Path	/Applications/MAMP/bin/php/php7.4.2/conf
Loaded Configuration File	/Applications/MAMP/bin/php/php7.4.2/conf/php.ini
Scan this dir for additional .ini files	(none)
Additional .ini files parsed	(none)
PHP API	20190902
PHP Extension	20190902
Zend Extension	320190902
Zend Extension Build	API320190902,NTS
PHP Extension Build	API20190902,NTS
Debug Build	no
Thread Safety	disabled
Zend Signal Handling	enabled
Zend Memory Manager	enabled
Zend Multibyte Support	provided by mbstring
IPv6 Support	enabled
DTrace Support	disabled
Registered PHP Streams	https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports	tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters	zlib.*, bzip2.*, 

Logging in with adminer-4.3.1.php with the connection details as above into the omeka database works just fine.

Can anyone spot what I might need to to change to allow this job to take place? And how could I delete the past jobs?

What does which php print when you run it in the console?

I believe the issue with the connection isn’t anything to do with the database.ini needing changes or anything like that, it’s just that MAMP ships its own PHP with its own settings, including for the default MySQL socket. When you’re running php on the command line, you’re probably not running the MAMP version, which would cause all sorts of problems.

You want to instead be running /Applications/MAMP/bin/php/<your php version>/bin/php (or something along those lines). If you can run that successfully through the terminal, you can set the PHP CLI path configuration setting in local.config.php to the correct path and it should resolve this issue.

1 Like

Thanks a lot. The php on the console is /usr/bin/php
but I will have a look again and see. Perhaps my way of testing the connection was not right then, and it is rather something with how Omeka and the MAMP service talk to each other?

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