khalequzzaman17

MySQL Bug Fixer - cPanel

Oct 17th, 2021 (edited)
272
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. if (!is_dir('/usr/local/cpanel')) {
  4.     $mysqldstats = trim(exec("systemctl is-active mysqld"));
  5.     if (stristr($mysqldstats, "active")) {
  6.         //echo "mysqld is running";
  7.     } else {
  8.         //echo "mysqld is not running";
  9.         $mysqlddir = "/var/run/mysqld";
  10.         if (!file_exists($mysqlddir) && !is_dir($mysqlddir)) {
  11.             mkdir($mysqlddir);
  12.             //changing the ownership
  13.             $dirowner = "mysql";
  14.             chown($mysqlddir, $dirowner);
  15.             exec("systemctl start mysqld");
  16.         }
  17.     }
  18. }
  19.  
  20. ?>
RAW Paste Data