命令行支援
ServBay提供了命令行支援,允許您在bash或者zsh中安裝ServBay的命令行工具。以下是安裝步驟:
- 打開 ServBay,點擊左側導航列的
設定
。
- 在設定頁面中,找到
命令行工具
選項。 - 根據您的終端環境,點擊
安裝 cli 工具到 zsh
或安裝 cli 工具到 bash
。
- 安裝完成後,重新打開您的終端,命令行工具將會生效。
設定預設包版本
如果您希望設定預設的軟體版本,例如預設的 PHP 或 MariaDB 版本,您可以參考設定預設版本文件了解詳細步驟。
執行特定版本的PHP
ServBay支援直接執行特定版本的PHP,例如php-5.6
或phpize-8.3
。您可以在終端中使用這些命令來操作特定版本的PHP。
範例命令
- 查看當前安裝的 PHP 版本:
bash
php -v
1
- 使用 PHP 5.6 執行 PHP 腳本:
bash
php-5.6 your_script.php
1
- 連接到PostgreSQL資料庫:
bash
psql -h localhost -U your_user -d your_database
1
- 執行 SQL 查詢:
bash
psql -h localhost -U your_user -d your_database -c "SELECT * FROM your_table;"
1
- 查看Redis狀態:
bash
redis-cli info stats
1
通過這些範例命令,你可以在命令行環境中利用ServBay提供的各種服務。