Import from the command line

Hi, good morning.

We are trying to schedule a daily user data upload to the PHPList database by executing the following command.


php index.php -m SubscribersPlugin -p import -c …/config/config.php -l 1 -f /tmp/data.csv

The problem we have is that it gives us the following error.


phpList XXXX - phpList version 3.5.3 © 2000-2020 phpList Ltd, https://www.phplist.com

Error: The security certificate is not valid, please reload the page and try again

Can you help us with this mistake? The site is running with an Entrust certificate in which we upload both the intermediate certificates with the RootCA .

On the other hand, the operating system is RedHat 7, PHP version 5.4.16 and Httpd version 2.4.6.

If you need any more information tell me.

Thank you very much.

@sanake Your command does not match the example in the plugin documentation https://resources.phplist.com/plugin/subscribers#import_from_the_command_line

I recommend using full file system paths instead of relative paths. In particular “…/config/config.php” does not look correct.

It is the same, anyway in the link put “import2” and that gives error.

/usr/bin/php /var/www/html/XXX/admin/index.php m SubscribersPlugin -p import2 -c /var/www/html/XXX/config/config.php -l 1 -f /tmp/datos.csv
phpList XXX - phpList version 3.5.3 © 2000-2020 phpList Ltd, https://www.phplist.com

Error: import2 does not process command line

It’s the same, anyway in the link it says “import2” and that gives an error.

Error: import2 does not process command line

I tried with absolute paths and it gives the same error.

Even if you change “import2” to “import” you still get the same error.

Error: The security certificate is not valid, please reload the page and try again

I guess that the command php is not running php cli (command line). Can you find out how to run php cli.
Also, the page is import2.

When i run

/ usr / bin / php /var/www/html/admin/index.php -c /var/www/html/config/config.php

the output is:

phpList XXX - Available options:
dbcheck
send
processqueue
processbounces
import
upgrade
convertstats
reindex
blacklistemail
systemstats
converttoutf8
initlanguages
cron
updatetlds
runcommand

And in that list of available options there is no “import2”.

Thank you

But anyway, even if I use the “import” option it still gives me the invalid certificate problem.

@sanake Have you enabled the plugin on the Manage Plugins page?

What a plugin. I don’t know what plugin you say.

@sanake Please see the plugin documentation that I referred you to earlier.

Hey, Duncan, good morning.

I’ve installed the “Subscribers” plugin, I’ve read the documentation and I wasn’t really doing it right.

Now I have the plugin activated and when I execute the command that you provide in the documentation with the version of PHPList that I have installed it gives a PHP error.


PHP Parse error: syntax error, unexpected ‘.’, expecting ‘&’ or variable (T_VARIABLE) in /opt/phplist-3.5.3/lists/admin/plugins/Common/DAO/AttributeTrait.php on line 48


Can you tell me if it’s a versioning problem?

@sanake php needs to be at least version 5.6.

Okay thanks, we’ll update.

The import for another user will be done only as demo since the user is required to have specific privileges. We will use a user with login name importer1, who could be in real life e.g. a facility manager.