Chúc mừng Tết Trung Thu 15% off everything Shop the sale
Browse topics
Intermediate All add-ons

Install, upgrade and rebuild add-ons from the command line

XenForo's cmd.php runs installs and upgrades without browser timeouts. The commands you need, and when to use them.

Updated 3 min read By the D.C Style team

On this page

Before you start

Every XenForo forum includes cmd.php, a command-line tool that does the same jobs as the Add-ons page: install, upgrade, disable and more. Because it runs on the server rather than in your browser, it has no page time limit. That makes it the reliable choice for large forums and for any upgrade that keeps timing out.

Getting started

Connect to your server over SSH and change to your XenForo root, the folder that holds cmd.php and admin.php:

cd /path/to/your/forum
php cmd.php list

list prints every command available, including the ones add-ons add. Add-ons are referred to by their ID, which matches their folder under src/addons. The add-on in src/addons/DC/Thumbnail is DC/Thumbnail.

Tip: Run these commands as the same system user that owns your forum files where you can. Files created by a different user can leave the web server unable to update them later.

Install an add-on

Upload the contents of the add-on's upload folder as usual, then run:

php cmd.php xf:addon-install DC/Thumbnail

You can also skip the FTP step and point the command at the zip file you downloaded:

php cmd.php xf:addon-install /path/to/the-add-on.zip

Upgrade an add-on

Upload the new files over the old ones, then run:

php cmd.php xf:addon-upgrade DC/Thumbnail

This command also accepts the path to a zip file. As in the Admin CP, you can skip versions: every upgrade step between your version and the new one runs in order. More on upgrading.

Other useful commands

CommandWhat it does
xf:addon-listLists installed add-ons with their IDs and versions. Add --active or --inactive to filter.
xf:addon-disable DC/ThumbnailSwitches an add-on off and keeps its data. With no ID, it disables every enabled add-on.
xf:addon-enable DC/ThumbnailSwitches it back on. With no ID, it enables every disabled add-on.
xf:addon-rebuild DC/ThumbnailRe-imports the add-on's data (options, phrases, templates and so on) from its files. Useful when something is missing after an upload.
xf:addon-uninstall DC/ThumbnailUninstalls the add-on and removes its data. Read this first.
xf:file-checkRuns the file health check. Add --addon=DC/Thumbnail to check one add-on.
xf:rebuild-master-dataRebuilds XenForo's own core data.
xf:run-jobsRuns any background jobs that are waiting. Cron and the job runner.

Most add-on commands also accept --force, which skips XenForo's safety checks. Leave it off unless we ask you to use it while helping you in a ticket.

When the command line saves the day

  • An upgrade times out in the browser. Run the same upgrade with xf:addon-upgrade.
  • An add-on has broken the site. xf:addon-disable can often switch it off even when you cannot reach the Admin CP. If that fails too, this guide has a one-line fallback in config.php.
  • A long migration or rebuild. Some add-ons ship their own commands for heavy work, such as moving files in Google Drive Attachments or rebuilding thumbnails in Thumbnail. They show up in php cmd.php list.

Still stuck? Open a support ticket and paste the full command you ran and everything it printed.

Did this guide help? Thanks! Glad it worked. Sorry about that. What went wrong? Thanks for telling us. We'll use it to improve this guide.

What went wrong?
Need a reply? Open a ticket instead.

Still stuck? Open a ticket