meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
system:commandline [2017/10/03 16:30] – Extended info on sub-commands; general cleanup samtuke | system:commandline [2018/11/26 00:46] (current) – [Commandline processing requires PHP 4.3.0 or higher] suela_phplist.com | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== How to set up phpList command-line interface (CLI) ====== | ||
+ | |||
+ | To be able to run phpList from commandline you need to use the **CLI version of PHP**. | ||
+ | |||
+ | To verify your version, type | ||
+ | |||
+ | < | ||
+ | |||
+ | This should return something similar to the following: | ||
+ | |||
+ | < | ||
+ | PHP 7.1.9 (cli) (built: Sep 6 2017 11:45:26) ( NTS ) | ||
+ | Copyright (c) 1997-2017 The PHP Group | ||
+ | Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies | ||
+ | with Zend OPcache v7.1.9, Copyright (c) 1999-2017, by Zend Technologies | ||
+ | with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans | ||
+ | </ | ||
+ | |||
+ | |||
+ | The (cli) on the first line indicates the **CLI version of PHP**. It should not say " | ||
+ | |||
+ | |||
+ | ===== install phpList on commandline ===== | ||
+ | |||
+ | Use your favourite command-line text editor to edit (or create if it doesn' | ||
+ | |||
+ | < | ||
+ | |||
+ | With the following content, replacing the paths with what is appropriate for your environment: | ||
+ | |||
+ | < | ||
+ | #!/bin/bash | ||
+ | |||
+ | / | ||
+ | </ | ||
+ | |||
+ | Make it executable: | ||
+ | |||
+ | < | ||
+ | |||
+ | The crucial element is the **"-c config.php" | ||
+ | |||
+ | From then on, you will be able to execute phpList from the command-line. | ||
+ | |||
+ | ===== Executing sub-commands ===== | ||
+ | |||
+ | To execute a sub-command run the phpList binary with the -p flag followed by the sub-command name without a space. E.g.: | ||
+ | |||
+ | < | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | ===== Available sub-commands ===== | ||
+ | |||
+ | Running the phpList command-line script with no arguments will result in a printed list of available sub-commands. The list should look like this: | ||
+ | |||
+ | < | ||
+ | dbcheck | ||
+ | send | ||
+ | processqueue | ||
+ | processbounces | ||
+ | import | ||
+ | upgrade | ||
+ | convertstats | ||
+ | reindex | ||
+ | blacklistemail | ||
+ | systemstats | ||
+ | converttoutf8 | ||
+ | initlanguages | ||
+ | cron | ||
+ | updatetlds | ||
+ | runcommand | ||
+ | </ | ||
+ | |||
+ | ===== Popular commands ===== | ||
+ | |||
+ | Two of the most commonly used sub-commands are: | ||
+ | |||
+ | Processqueue (processes the available queues to send queued campaigns): | ||
+ | |||
+ | < | ||
+ | phplist -pprocessqueue | ||
+ | </ | ||
+ | |||
+ | Process Bounces (process bounce messages received from remote servers and update subscribers bounce records): | ||
+ | |||
+ | < | ||
+ | phplist -pprocessbounces | ||
+ | </ | ||
+ | |||
+ | ===== README.commandline ===== | ||
+ | |||
+ | Commandline processing requires PHP 4.3.0 or higher. | ||
+ | |||
+ | A few pages in the phpList system can since version 2.7.0 be run with a simple command from the commandline. | ||
+ | |||
+ | The script to use is called " | ||
+ | |||
+ | The normal phpList access restrictions are bypassed, but the Unix users who are allowed to run the script should be mentioned in the " | ||
+ | |||
+ | The " | ||
+ | mentioned above you can also use phplist -psend. | ||
+ | |||
+ | **This will require some more arguments: | ||
+ | |||
+ | * -l list | ||
+ | * -s subject | ||
+ | * [-f from] | ||
+ | |||
+ | and you need to " | ||
+ | |||
+ | * The -l parameter can have two types of values, the name of the list or the number of the list. You can add multiple lists or multiple -l parameters | ||
+ | * The subject can have spaces | ||
+ | * The from is optional. It will default to the system administrator as set up in your config. | ||
+ | |||
+ | **So the full " | ||
+ | |||
+ | phplist -psend -s This is the subject -l test 1 2 3 -f me@server.com < messagefile | ||