Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 388
Lokesh Joshi Avatar asked Dec 19 '25 06:12

Lokesh Joshi


2 Answers

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.

like image 73
MONZTAAA Avatar answered Dec 21 '25 18:12

MONZTAAA


On Joomla 5, it can be quite easy. Use the cli/joomla.php interface with the respective extension installation command. For instance, with an apache system under linux, do (possibly replace paths):

sudo runuser -u www-data -- php /var/www/joomla/cli/joomla.php \
    extension:install --path /var/www/com_mycomponent.zip 

Just make sure the file can be read by www-data. For more useful commands of the interface, use the --help switch:

php /path/to/joomla/cli/joomla.php --help

or list the commands directly:

php /path/to/joomla/cli/joomla.php list
like image 23
DomTomCat Avatar answered Dec 21 '25 18:12

DomTomCat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!