$ sudo -u apache /usr/bin/php admin/cli/maintenance.php -disable $ sudo -u apache /usr/bin/php admin/cli/maintenance.php -enable
#DEBUG PHP SCRIPT COMMAND LINE HOW TO#
See the following procedure how to upgrade your site within several seconds to the most recent version while preserving your eventual local customizations tracked in git repository: Upgrading via command line is a very comfortable way of Moodle upgrade if you use Git checkout of the Moodle source code (see Git for Administrators). $ sudo -u apache /usr/bin/php admin/cli/upgrade.php Also, the script does not backup any data (if you read this page, you probably have some own scripts to backup your moodledata and the database, right?) The script itself does not put the site into the maintenance mode, you have to do it on your own.
As with the installation script, there is either interactive or non-interactive mode of the upgrade. Moodle can be upgraded from the command line. Typical values may be apache, www-data or httpd. The particular value depends on your OS distribution and local set-up. Examples on this page use the apache user for illustration. Note: These scripts are supposed to be run under the identity of the web server user. $ sudo -u apache /usr/bin/php admin/cli/install.php -help
#DEBUG PHP SCRIPT COMMAND LINE FULL#
Most of the scripts accept common -help (or -h) parameter to display the full usage information, for example: $ sudo -u apache /usr/bin/php admin/cli/somescript.php -params As a root, you will probably want to execute Moodle CLI scripts like this: In Linux distributions, the user that runs the web server is usually apache or www-data or httpd or something similar. It is especially important for CLI installation and upgrade as they create new files in moodledata directory and the web server has to have write access to them.
To avoid problems with access control, you should run them as the owner of the web server process. Other plugins may provide CLI functionality via scripts in their own cli folder.
Core admin CLI tools are located in the admin/cli/* folder. If you have shell access to your web server, you may find various CLI (command line interface) scripts useful during Moodle administration.