New plugins: core-tools New skills: auto-expense, ticket-triage, design, security-check, aiktop-tasks, daily-digest, imap-triage, index-update, mindmap, notebooklm, proc-creator, tasks-overview, validate-component, perfex-module, report, calendar-manager New agents: design-critic, design-generator, design-lead, design-prompt-architect, design-researcher, compliance-auditor, metabase-analyst, gitea-integration-specialist Updated: all plugin configs, knowledge datasets, existing skills Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
227 lines
5.2 KiB
Markdown
227 lines
5.2 KiB
Markdown
---
|
|
name: cwp-php
|
|
description: CWP PHP version management. PHP Switcher, Selector, configuration. Based on official CWP documentation only. Use when user mentions "php cwp", "versão php", "php selector", "php switcher".
|
|
author: Descomplicar® Crescimento Digital
|
|
version: 1.1.0
|
|
quality_score: 72
|
|
user_invocable: true
|
|
desk_task: null
|
|
---
|
|
|
|
# /cwp-php - Gestão PHP CWP (Documentação Oficial)
|
|
|
|
Gestão de versões PHP no CWP. **Zero assumptions, zero hallucinations** - apenas informação documentada.
|
|
|
|
**REGRA #38 - ZERO INVENCAO:** NUNCA improvisar comandos. Verificar estado actual ANTES de alterar. Pesquisar wiki CWP se necessario. Usar APENAS scripts oficiais.
|
|
|
|
---
|
|
|
|
## Servidor Alvo
|
|
|
|
| Servidor | IP | MCP | User |
|
|
|----------|-----|-----|------|
|
|
| **CWP Principal** | 176.9.3.158 | ssh-unified | root |
|
|
|
|
---
|
|
|
|
## Documentação Base
|
|
|
|
- [PHP Selector](https://wiki.centos-webpanel.com/php-selector)
|
|
- [PHP Version Switcher](https://wiki.centos-webpanel.com/php-version-switcher)
|
|
- [CWP Scripts](https://wiki.centos-webpanel.com/cwp-scripts)
|
|
|
|
### Documentação Hub (Consultar SEMPRE)
|
|
|
|
**Manuais locais** (`Hub/06-Operacoes/Documentacao/Manuais/CWP/`):
|
|
- `CWP-Manual-Completo.md` - Admin Guide (seccao PHP Settings, Switcher, Selector, FPM, PECL) + Wiki (PHP Configuration) - **503KB**
|
|
- `CWP-Guia-do-Utilizador.md` - Painel utilizador (seccao Edit PHP.ini, PHP Selector) - **72KB**
|
|
|
|
**Quick Reference:** `Hub/06-Operacoes/Documentacao/Quick-Reference/QR-CWP.md`
|
|
|
|
**NotebookLM (pesquisa AI sobre toda a documentacao CWP):**
|
|
```
|
|
mcp__notebooklm__notebook_query notebook_id:"0ded7bd6-69b3-4c76-b327-452396bf7ea7" query:"php versao selector switcher fpm configuracao"
|
|
```
|
|
|
|
---
|
|
|
|
## Ferramentas PHP no CWP
|
|
|
|
O CWP oferece 3 ferramentas para gerir PHP:
|
|
|
|
| Ferramenta | Função |
|
|
|------------|--------|
|
|
| **PHP Switcher** | Versão principal do CWP (default para novos clientes) |
|
|
| **PHP Selector** | Permite diferentes versões por pasta/domínio |
|
|
| **PHP-FPM Selector** | Para sites que usam PHP-FPM |
|
|
|
|
---
|
|
|
|
## Versões PHP Disponíveis (Documentadas)
|
|
|
|
PHP Selector suporta: **4.4, 5.2, 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1**
|
|
|
|
---
|
|
|
|
## Paths de Configuração
|
|
|
|
| Path | Descrição |
|
|
|------|-----------|
|
|
| `/usr/local/cwpsrv/htdocs/resources/conf/el7/php_switcher/` | Config CentOS 7 |
|
|
| `/usr/local/cwpsrv/htdocs/resources/conf/el8/php_switcher/` | Config CentOS 8 |
|
|
| `/var/log/php-rebuild.log` | Log de compilação PHP |
|
|
|
|
---
|
|
|
|
## Monitorizar Compilação PHP
|
|
|
|
```bash
|
|
# Ver log em tempo real durante instalação de versão PHP
|
|
tail -f /var/log/php-rebuild.log
|
|
|
|
# Ver log completo
|
|
cat /var/log/php-rebuild.log
|
|
```
|
|
|
|
---
|
|
|
|
## Scripts Oficiais
|
|
|
|
| Script | Descrição |
|
|
|--------|-----------|
|
|
| `/scripts/phpfpm_rebuild_user_conf` | Rebuild configuração PHP-FPM de utilizadores |
|
|
|
|
```bash
|
|
sh /scripts/phpfpm_rebuild_user_conf
|
|
```
|
|
|
|
---
|
|
|
|
## PHP por Pasta (Documentado)
|
|
|
|
Cada utilizador pode ter versão PHP diferente por pasta usando `.htaccess`:
|
|
|
|
```apache
|
|
# Exemplo .htaccess para usar PHP específico numa pasta
|
|
# (configurar via CWP PHP Selector primeiro)
|
|
```
|
|
|
|
---
|
|
|
|
## Desactivar Funções Perigosas (Documentado)
|
|
|
|
### PHP Switcher
|
|
|
|
```bash
|
|
echo "disable_functions = exec, system, popen, proc_open, shell_exec, passthru, show_source" > /usr/local/php/php.d/disabled_function.ini
|
|
```
|
|
|
|
**Nota:** Cada versão PHP tem caminho diferente.
|
|
|
|
---
|
|
|
|
## Adicionar Flags de Compilação (Documentado)
|
|
|
|
**Ficheiro exemplo CentOS 7 PHP 7.0:**
|
|
`/usr/local/cwpsrv/htdocs/resources/conf/el7/php_switcher/7.0.ini`
|
|
|
|
### Formato
|
|
|
|
```ini
|
|
[nome-unico]
|
|
default=0
|
|
option="--enable-opcao"
|
|
```
|
|
|
|
**Aviso documentado:** "CWP update will overwrite these files" - documentar alterações para reaplicar após updates.
|
|
|
|
---
|
|
|
|
## Verificações
|
|
|
|
### Versão PHP Actual
|
|
|
|
```bash
|
|
php -v
|
|
```
|
|
|
|
### Memory Limit
|
|
|
|
```bash
|
|
php -i | grep memory_limit
|
|
```
|
|
|
|
### OPcache Status
|
|
|
|
```bash
|
|
php -i | grep -E 'opcache.enable|opcache.memory_consumption'
|
|
```
|
|
|
|
### Processos PHP-FPM
|
|
|
|
```bash
|
|
ps aux | grep php-fpm | wc -l
|
|
```
|
|
|
|
---
|
|
|
|
## Workflows
|
|
|
|
### 1. Verificar Versão PHP
|
|
|
|
```bash
|
|
php -v | head -1
|
|
```
|
|
|
|
### 2. Ver Configuração PHP
|
|
|
|
```bash
|
|
php -i | grep -E 'memory_limit|upload_max|post_max|max_execution'
|
|
```
|
|
|
|
### 3. Rebuild PHP-FPM Config
|
|
|
|
```bash
|
|
sh /scripts/phpfpm_rebuild_user_conf
|
|
```
|
|
|
|
### 4. Monitorizar Instalação de Versão PHP
|
|
|
|
```bash
|
|
tail -f /var/log/php-rebuild.log
|
|
```
|
|
|
|
---
|
|
|
|
## Anti-Patterns (NUNCA FAZER)
|
|
|
|
| Anti-Pattern | Risco | Alternativa |
|
|
|--------------|-------|-------------|
|
|
| Editar .ini sem documentar | Perdido em update | Documentar alterações |
|
|
| Compilar PHP manualmente | Conflito com CWP | Usar PHP Selector |
|
|
| Ignorar php-rebuild.log | Não detectar erros | Monitorizar sempre |
|
|
|
|
---
|
|
|
|
## Notas Importantes
|
|
|
|
1. **PHP Switcher** é a versão default para novos utilizadores
|
|
2. **PHP Selector** permite versão por pasta
|
|
3. Updates do CWP podem sobrescrever configurações personalizadas
|
|
4. Sempre documentar alterações para reaplicar
|
|
|
|
---
|
|
|
|
## Checklist
|
|
|
|
- [ ] Verificar versão actual (`php -v`)
|
|
- [ ] Verificar configuração (`php -i`)
|
|
- [ ] Se alterar, documentar mudanças
|
|
- [ ] Testar sites após alterações
|
|
- [ ] Verificar logs se problemas
|
|
|
|
---
|
|
|
|
**Versão:** 1.0.0 | **Autor:** Descomplicar®
|
|
**Fonte:** wiki.centos-webpanel.com/php-selector, wiki.centos-webpanel.com/php-version-switcher
|