I also have a PHP site running on my virtual server, this PHP site was also migrated over from cPanel along with everything else.
cPanel was using PHP version 5.6.38 whereas Virtualmin is using PHP 7.2.24
Ever since I migrated to Virtualmin, this PHP site can no longer connect to the database. I checked the connection string in the PHP code and used the same username and password in MySQL workbench, it is working fine there. So I’m guessing it has something to do with the PHP version?
Thanks @Ilia , I verified that php-mysql package is installed and I found the problem in the error logs, it is configuration from cPanel earlier that is causing the problems, here is what the error message is:
[Tue Feb 25 19:22:38.030380 2020] [fcgid:warn] [pid 7475] [client 183.90.37.221:10971] mod_fcgid: stderr: PHP Warning: session_start(): open(/var/cpanel/php/sessions/ea-php56/sess_mt8kudd88p8s01qvmidc92t6nt, O_RDWR) failed: No such file or directory (2) in /home/snatch/public_html/admin/login-page.php on line 2, referer: https://snatch.com/admin/login-page.php
[Tue Feb 25 19:22:38.030411 2020] [fcgid:warn] [pid 7475] [client 183.90.37.221:10971] mod_fcgid: stderr: PHP Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/ea-php56) in /home/snatch/public_html/admin/login-page.php on line 2, referer: https://snatch.com/admin/login-page.php
Also here is the content of my php.ini file, it is referring to a session directory from cPanel, any idea what I should change it to?:
; cPanel-generated php ini directives, do not edit ; Manual editing of this file may result in unexpected behavior. ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor) ; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
Yes, just put this inside of your webserver root and outside of public_html. You could put it also inside of public_html but make sure to deny anyone accessing it.