Search code examples
phpjoomlacommand-line-interfacejoomla3.0

How to install joomla extension by command


I am trying to install extension by command.

In server already configure the PHP CLI and I'm using this code :

shell_exec('php-cli '.$SitefilePath.' --package='.$packagePath.'');

I have upload the file:

https://raw.githubusercontent.com/akeeba/vagrant/master/vagrant/files/joomla/install-joomla-extension.php

In the CLI folder and pass path as SitefilePath into command. but its not working.

I have checked with all option :

http://www.php-cli.com/php-cli-options.shtml

Let me know how to get this work.


Solution

  • All of these issues have been properly debugged in the install-joomla-extension.php script I wrote.

    First, create a new plain text file and paste that code in it. Save it as install-joomla-extension.php in your Joomla! site's cli directory. The name is not important, the location (cli directory) is.

    Now you can call it like this:

    cd /path/to/site/cli php ./install-joomla-extension.php --package=/where/is/your/extension.zip

    The script returns one of the following exit statuses:

    1. The extension was installed successfully.
    2. The package file was not found.
    3. The package file could not be extracted.
    4. The extension could not be installed. You can copy this file to your site's cli directory and install extensions and extension updates any time you want.

    Source: https://www.dionysopoulos.me/238-installing-joomla-extensions-from-the-command-line.html

    Let me know if this works.