
[1m================================================[0m
[1m CMPTV — Complete VPS Setup[0m
[1m Log: /var/log/cmptv-setup-20260407-034252.log[0m
[1m================================================[0m

[1m[0;34m--- PHASE 1: Environment Detection ---[0m
  [0;32m✓[0m  Running as root — using cPanel home: /home/cmptv
  [0;32m✓[0m  OS: AlmaLinux 9.7 (Moss Jungle Cat) | Kernel: 5.14.0-611.26.1.el9_7.x86_64 | IP: 76.13.114.192
  [0;32m✓[0m  cPanel: 134.0 (build 15)
  [0;32m✓[0m  Web server: httpd Apache/2.4.66
  [0;32m✓[0m  PHP: 8.3.30 | Binary: /opt/cpanel/ea-php83/root/usr/bin/php
  [0;32m✓[0m  PHP INI: /opt/cpanel/ea-php83/root/etc/php.ini
  [0;32m✓[0m  MySQL/MariaDB: 10.11.16-MariaDB | Config: /etc/my.cnf
  [0;32m✓[0m  Total RAM: 15730MB
  [0;32m✓[0m  Multisite (23 sites): /home/cmptv/News.cmptv.ca.2025-12-15 → https://news.cmptv.ca
  [0;32m✓[0m  Multisite (1 sites): /home/cmptv/News.cmptv.ca → https://news.cmptv.ca
  [0;32m✓[0m  Multisite (3 sites): /home/cmptv/public_html → https://cmptv.ca
  [0;32m✓[0m  WP-CLI: 

[1m[0;34m--- PHASE 2: PHP Optimisation ---[0m
  [0;32m✓[0m  PHP ini written: /home/cmptv/php.ini
  [0;32m✓[0m    memory_limit=512M | max_execution_time=300 | max_input_vars=5000
---
metadata:
  command: php_ini_set_directives
  reason: "API failure: (XID y4bbd8) Provide the “version” parameter for the “Whostmgr::API::1::Lang::PHP::php_ini_set_directives” function."
  result: 0
  version: 1
  [0;32m✓[0m  WHM API PHP settings applied
  [0;32m✓[0m  PHP memory_limit active: 128M

[1m[0;34m--- PHASE 3: MySQL/MariaDB Tuning ---[0m
  [0;32m✓[0m  MySQL tuning config written: /etc/my.cnf.d/cmptv-tuning.cnf
  [0;32m✓[0m    innodb_buffer_pool_size=2048M | max_connections=150
---
data:
  service: mysql
metadata:
  command: restartservice
  output:
    raw: "Waiting for “mysql” to restart ……waiting for “mysql” to initialize ………finished.\n\nService Status\n\tmariadb (/usr/sbin/mariadbd) is running as mysql with PID 1650640 (systemd+/proc check method).\n\nStartup Log\n\tApr 07 03:43:00 srv1313793.hstgr.cloud systemd[1]: Starting MariaDB 10.11.16 database server...\n\tApr 07 03:43:00 srv1313793.hstgr.cloud mariadbd[1650640]: 2026-04-07  3:43:00 0 [Warning] Could not increase number of max_open_files to more than 42000 (request: 64185)\n\tApr 07 03:43:01 srv1313793.hstgr.cloud systemd[1]: Started MariaDB 10.11.16 database server.\n\nmysql restarted successfully.\n"
  reason: OK
  result: 1
  version: 1
  [0;32m✓[0m  MySQL restarted via WHM API

[1m[0;34m--- PHASE 4: Real Server Cron (replacing WordPress fake cron) ---[0m
  [0;32m✓[0m  Added DISABLE_WP_CRON to: /home/cmptv/public_html/wp-config.php
  [0;32m✓[0m  Added DISABLE_WP_CRON to: /home/cmptv/News.cmptv.ca.2025-12-15/wp-config.php
  [0;32m✓[0m  Added DISABLE_WP_CRON to: /home/cmptv/News.cmptv.ca/wp-config.php
  [0;32m✓[0m  Cron already exists: */5 * * * * /opt/cpanel/ea-php83/root/usr/bin/php /home/cmpt...
  [0;32m✓[0m  Cron already exists: */5 * * * * /opt/cpanel/ea-php83/root/usr/bin/php /home/cmpt...
  [0;32m✓[0m  Cron already exists: */15 * * * * /opt/cpanel/ea-php83/root/usr/bin/php /home/cmp...
  [0;32m✓[0m  Cron already exists: 2,7,12,17,22,27,32,37,42,47,52,57 * * * * /opt/cpanel/ea-php...
  [0;32m✓[0m  Cron already exists: 0 3 * * * df -h /home/cmptv >> /var/log/cmptv-disk.log 2>&1...
  [0;32m✓[0m  Crontab updated — 0 new entries added
  [0;32m✓[0m  Cron daemon: active

[1m[0;34m--- PHASE 5: manage.cmptv.ca — WordPress + MainWP Dashboard ---[0m
  [0;32m✓[0m  Created: /home/cmptv/manage.cmptv.ca
  [0;32m✓[0m  WordPress downloaded
Success: Generated 'wp-config.php' file.
  [0;32m✓[0m  wp-config.php created
WordPress is already installed.
  [0;32m✓[0m  WordPress installed
Success: Value passed for 'blog_public' option is unchanged.
Success: Value passed for 'default_comment_status' option is unchanged.
Success: Value passed for 'default_ping_status' option is unchanged.
Success: Value passed for 'users_can_register' option is unchanged.
Success: Rewrite structure set.
Success: Rewrite rules flushed.
Success: Rewrite rules flushed.
Deleted 'hello' plugin.
Success: Deleted 1 of 1 plugins.
Deleted 'twentytwentythree' theme.
Success: Deleted 1 of 3 themes.
  [0;32m✓[0m  Site hardened
  [0;32m✓[0m  MainWP Dashboard installed + activated

[1m[0;34m--- PHASE 6: MainWP Child → all sites ---[0m
  [0;32m✓[0m  MainWP Child files downloaded to network
Plugin 'mainwp-child' activated.
Success: Activated 1 of 1 plugins.
Plugin 'mainwp-child' activated.
Success: Activated 1 of 1 plugins.
Plugin 'mainwp-child' activated.
Success: Activated 1 of 1 plugins.
  [0;32m✓[0m  Multisite: 3 activated | 0 already active | 0 failed
  [1;33m⚠[0m  news.cmptv.ca not found at /home/cmptv/news.cmptv.ca

[1m[0;34m--- PHASE 7: WordPress Network Hardening ---[0m
  [0;32m✓[0m  Added: define('WP_POST_REVISIONS', 3)
  [0;32m✓[0m  Added: define('EMPTY_TRASH_DAYS', 7)
  [0;32m✓[0m  Added: define('WP_MEMORY_LIMIT', '256M')
  [0;32m✓[0m  Added: define('WP_MAX_MEMORY_LIMIT', '512M')
  [0;32m✓[0m  Added: define('DISALLOW_FILE_EDIT', true)
  [0;32m✓[0m  Added: define('WP_AUTO_UPDATE_CORE', true)
  [0;32m✓[0m  wp-config.php permissions: 600
  [0;32m✓[0m  Upload directory PHP execution blocked

[1m[0;34m--- PHASE 8: Web Server Performance ---[0m
  [0;32m✓[0m  .htaccess updated with compression + caching + security headers
  [0;32m✓[0m  RSS/XML feeds: CORS enabled for signage players

[1m[0;34m--- PHASE 9: Cloudflare ---[0m
  [0;32m✓[0m  Cloudflare credentials provided — checking DNS records
/root/cmptv-vps-setup.sh: line 458: [: 0
0: integer expression expected
  [1;33m⚠[0m  Wildcard DNS *.cmptv.ca — NOT FOUND
  Creating wildcard A record for *.cmptv.ca → 76.13.114.192
  [1;33m⚠[0m  Could not auto-create — add manually in Cloudflare dashboard
  [1;33m⚠[0m  manage.cmptv.ca A record — not found (covered by wildcard if enabled)

[1m[0;34m--- PHASE 10: SSL Certificates ---[0m
  [0;32m✓[0m  cmptv.ca — expires: Jun 27 23:12:40 2026 GMT
  [0;32m✓[0m  news.cmptv.ca — expires: Jun  7 22:51:43 2026 GMT
  [0;32m✓[0m  manage.cmptv.ca — expires: Mar 19 16:38:03 2026 GMT
  [0;32m✓[0m  pembroke.cmptv.ca — expires: Mar 19 16:38:03 2026 GMT
  [0;32m✓[0m  oshawa.cmptv.ca — expires: Mar 19 16:38:03 2026 GMT

  cPanel → SSL/TLS → AutoSSL → Run AutoSSL for all subdomains

[1m[0;34m--- PHASE 11: Writing cmptv-env.conf ---[0m
  [0;32m✓[0m  cmptv-env.conf written: /root/cmptv-env.conf

[1m[0;34m--- PHASE 12: Readiness Report ---[0m

  [0;32m✓[0m  cPanel detected                              
  [0;32m✓[0m  WP-CLI available                             
  [0;32m✓[0m  MySQL running                                
  [0;32m✓[0m  Cron daemon active                           
  [0;32m✓[0m  DISABLE_WP_CRON set                          
  [0;32m✓[0m  Multisite root exists                        
  [0;31m✗[0m  news.cmptv.ca exists                           ← check path
  [0;32m✓[0m  manage.cmptv.ca exists                       
  [0;32m✓[0m  MainWP Dashboard installed                   
  [0;31m✗[0m  PHP memory >= 256M                             ← check PHP ini
  [0;32m✓[0m  cmptv-env.conf written                       

[1m================================================[0m
[1m SETUP COMPLETE[0m
 Log saved: /var/log/cmptv-setup-20260407-034252.log

 MainWP Dashboard:
   URL:  https://manage.cmptv.ca/wp-admin
   User: admin

 NEXT STEPS:
   1. Log into manage.cmptv.ca/wp-admin — change password immediately
   2. MainWP → Sites → Add New Site — add each subsite
   3. MainWP → Dashboard → Sync All
   4. Run: bash cmptv-multisite-setup.sh
   5. Run: bash cmptv-news-build.sh
   6. Cloudflare: verify *.cmptv.ca wildcard DNS
   7. cPanel AutoSSL: ensure all subdomains have certificates
[1m================================================[0m
