Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 534
Joomla CLI 使用指南 - Bluetooth forum - bluetooth蓝牙技术

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbjdownloads/cbjdownloads.php on line 49

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbblogs/cbblogs.php on line 48

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/components/com_comprofiler/plugin/user/plug_cbarticles/cbarticles.php on line 47

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323
Technical discuss

Joomla CLI 使用指南


Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323

Deprecated: Using null as the key parameter for array_key_exists() is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/cbPluginHandler.php on line 323
  • btt
  • [btt]
  • Topic Author
  • New Member
  • New Member
More
05 Jan 2026 12:45 #982 by btt
New Topic
一、Joomla CLI 的基本用法1. CLI 的位置Joomla CLI 位于网站根目录的 
Code:
cli
 文件夹中:
网站根目录/
├── cli/
│   └── joomla.php  ← Joomla CLI 主文件
├── administrator/
├── components/
├── plugins/
└── ...

2. 如何调用 Joomla CLI

# 进入网站根目录
cd /var/www/html/your-joomla-site

# 查看可用命令
php cli/joomla.php

# 或查看特定命令的帮助
php cli/joomla.php extension:install --help


3. 安装扩展的命令
# 基本安装命令
php cli/joomla.php extension:install pkg_socialpay_j5_v3.0.0.zip

# 如果文件不在当前目录,使用绝对路径
php cli/joomla.php extension:install /path/to/pkg_socialpay_j5_v3.0.0.zip

# 启用调试模式
php cli/joomla.php extension:install pkg_socialpay_j5_v3.0.0.zip --debug

# 指定管理员凭据(如果安装需要)
php cli/joomla.php extension:install pkg_socialpay_j5_v3.0.0.zip --username=admin --password=your_password


二、ZIP 文件的存放位置
 推荐位置:
  1. 上传到 Joomla 临时目录(最佳实践):
    • 路径:
      Code:
      网站根目录/tmp/
    • 命令:
      Code:
      php cli/joomla.php extension:install tmp/pkg_socialpay_j5_v3.0.0.zip
  2. 网站根目录(也可以,但不推荐):
    • 路径:
      Code:
      网站根目录/pkg_socialpay_j5_v3.0.0.zip
    • 命令:
      Code:
      php cli/joomla.php extension:install pkg_socialpay_j5_v3.0.0.zip
  3. 任意目录(使用绝对路径):
    • 路径:
      Code:
      /home/user/downloads/pkg_socialpay_j5_v3.0.0.zip
    • 命令:
      Code:
      php cli/joomla.php extension:install /home/user/downloads/pkg_socialpay_j5_v3.0.0.zip
三、Windows 和 Linux 的 CLI 使用示例Windows 示例(XAMPP/WAMP):# 进入 XAMPP 的 htdocs 目录
cd D:\xampp\htdocs\joomla5

# 查看所有可用命令
php cli\joomla.php

# 安装扩展包
php cli\joomla.php extension:install pkg_socialpay_j5_v3.0.0.zip

# 或使用完整路径
php cli\joomla.php extension:install D:\downloads\pkg_socialpay_j5_v3.0.0.zipLinux 示例:# 进入网站目录
cd /var/www/html/joomla5

# 给予临时目录写权限(如果需要)
sudo chmod 777 tmp

# 复制扩展包到临时目录
cp /home/user/pkg_socialpay_j5_v3.0.0.zip tmp/

# 安装扩展
php cli/joomla.php extension:install tmp/pkg_socialpay_j5_v3.0.0.zip四、完整的安装步骤# 步骤 1:上传文件到服务器(可以通过FTP或SCP)
# 例如:上传到 /var/www/html/joomla5/tmp/

# 步骤 2:通过SSH连接到服务器
ssh username@yourserver.com

# 步骤 3:进入Joomla目录
cd /var/www/html/joomla5

# 步骤 4:查看当前已安装的扩展
php cli/joomla.php extension:list

# 步骤 5:尝试安装(带调试)
php cli/joomla.php extension:install tmp/pkg_socialpay_j5_v3.0.0.zip --debug五、CLI 安装时的常见错误错误 1:权限不足# 解决方法:确保Joomla有写入权限
sudo chown -R www-data:www-data /var/www/html/joomla5
sudo chmod -R 755 /var/www/html/joomla5
sudo chmod 777 /var/www/html/joomla5/tmp错误 2:PHP内存限制# 编辑 php.ini 或在命令中指定
php -d memory_limit=256M cli/joomla.php extension:install tmp/pkg_socialpay_j5_v3.0.0.zip错误 3:扩展包损坏# 检查ZIP文件
unzip -t tmp/pkg_socialpay_j5_v3.0.0.zip

# 查看ZIP内容
unzip -l tmp/pkg_socialpay_j5_v3.0.0.zip六、推荐的使用流程# 1. 首先测试扩展包结构
php cli/joomla.php extension:discover

# 2. 如果扩展需要数据库操作,先备份
php cli/joomla.php extension:manage backup

# 3. 安装扩展
php cli/joomla.php extension:install tmp/pkg_socialpay_j5_v3.0.0.zip

# 4. 启用所有相关插件
php cli/joomla.php extension:state plg_authentication_wechat 1
php cli/joomla.php extension:state plg_authentication_alipay 1
php cli/joomla.php extension:state plg_system_socialauth 1

# 5. 列出已安装的扩展
php cli/joomla.php extension:list | grep -i social七、故障排除脚本创建一个脚本 
Code:
install_debug.sh


#!/bin/bash
# install_debug.sh

echo "=== Joomla CLI 安装调试脚本 ==="
echo "当前目录: $(pwd)"

# 检查Joomla CLI是否存在
if [ ! -f "cli/joomla.php" ]; then
    echo "❌ 错误:未找到Joomla CLI"
    echo "请在Joomla根目录运行此脚本"
    exit 1
fi

# 检查ZIP文件
ZIP_FILE="pkg_socialpay_j5_v3.0.0.zip"
if [ ! -f "$ZIP_FILE" ]; then
    echo "❌ 错误:未找到 $ZIP_FILE"
    echo "请将扩展包放在当前目录"
    exit 1
fi

echo "✅ 找到Joomla CLI"
echo "✅ 找到扩展包: $ZIP_FILE"
echo ""

# 检查ZIP包结构
echo "=== 检查ZIP包结构 ==="
unzip -l "$ZIP_FILE" | head -20
echo ""

# 检查XML文件
echo "=== 检查XML文件 ==="
unzip -p "$ZIP_FILE" "pkg_socialpay.xml" 2>/dev/null | head -5
echo ""

# 尝试安装
echo "=== 开始安装 ==="
php cli/joomla.php extension:install "$ZIP_FILE" --debug















 

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 234

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 189

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 237

Deprecated: Using null as an array offset is deprecated, use an empty string instead in /var/www/html/libraries/CBLib/CB/Legacy/LegacyFoundationFunctions.php on line 239

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
FaLang translation system by Faboba

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100
mysqli object is already closed (500 Whoops, looks like something went wrong.)

Error

HTTP 500 Whoops, looks like something went wrong.

mysqli object is already closed

Exception

Error

  1. */
  2. public function disconnect()
  3. {
  4. // Close the connection.
  5. if (\is_callable([$this->connection, 'close'])) {
  6. $this->connection->close();
  7. }
  8. parent::disconnect();
  9. }
  1. */
  2. public function disconnect()
  3. {
  4. // Close the connection.
  5. if (\is_callable([$this->connection, 'close'])) {
  6. $this->connection->close();
  7. }
  8. parent::disconnect();
  9. }
  1. *
  2. * @since 2.0.0
  3. */
  4. public function __destruct()
  5. {
  6. $this->disconnect();
  7. }
  8. /**
  9. * Alter database's character set.
  10. *
DatabaseDriver->__destruct()

Stack Trace

Error
Error:
mysqli object is already closed

  at /var/www/html/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:318
  at mysqli->close()
     (/var/www/html/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:318)
  at Joomla\Database\Mysqli\MysqliDriver->disconnect()
     (/var/www/html/libraries/vendor/joomla/database/src/DatabaseDriver.php:496)
  at Joomla\Database\DatabaseDriver->__destruct()                

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100

Deprecated: Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect since PHP 8.1 in /var/www/html/plugins/system/falangdriver/falangdriver.php on line 100