Kali Linux web server shows blank pages (SOLVED)
After a recent update of PHP from 7.0 to 7.2 version in Kali Linux, a new bug has appeared: in Kali Linux the Apache web server shows pages with HTML code, but does not show most pages with PHP code. If this is your case, then this guide should help you.
Just in case, to be sure that the services of the web server and DBMS are running, run:
sudo systemctl start apache2.service sudo systemctl start mysql
Uncaught Error: Class 'mysqli' not found in
One of the signs that the problem in the conflict of PHP versions is an error in the logs of the web server, which says that the mysqli class cannot be found. At the same time, before the PHP update, the code on the server worked.
Errors of the web server in Kali Linux can be found in the /var/log/apache2/error.log file, for example:
tail /var/log/apache2/error.log
An error that indicates that the mysqli class was not found:
PHP Fatal error: Uncaught Error: Class 'mysqli' not found in /var/www/html/mutillidae/classes/MySQLHandler.php:212\nStack trace:\n#0 /var/www/html/mutillidae/database-offline.php(8): MySQLHandler::databaseAvailable()\n#1 {main}\n thrown in /var/www/html/mutillidae/classes/MySQLHandler.php on line 212
How in Kali Linux switch from PHP 7.0 or PHP 7.2 to PHP 7.3
The problem seems to be related to the fact that after PHP 7.2 or PHP 7.3 is installed, the version of PHP 7.0 still continues to be used. And in spite of the fact that extensions, for example such as php7.0-mysql, do not disappear from the system, but they cease to be picked up by the PHP interpreter and the server can no longer fully work with PHP code.
The simplest way that will solve this problem is disabling PHP 7.0 for Apache and enabling PHP 7.2 for the web server, since in any case PHP 7.3 is installed automatically. To do this, execute:
sudo a2dismod php7.0 sudo a2dismod php7.2 sudo a2enmod php7.3 sudo a2disconf php7.0-fpm sudo a2disconf php7.2-fpm sudo systemctl restart apache2
After that, errors with missing modules should disappear, and pages with PHP code should start to be displayed.
To remove unnecessary versions of PHP and their tracks, you can run the following commands (this is optional):
sudo apt remove php7.0 sudo apt remove php7.2 sudo rm -rf /etc/php/7.0/ sudo rm -rf /etc/php/7.1/ sudo rm -rf /etc/php/7.2/ sudo apt autoremove
Related articles:
- Error in Kali Linux ‘The following signatures were invalid’ (SOLVED) (64.8%)
- Solving the problem with 'error: attempt to read or write outside of disk “hd0″' (64.8%)
- Kali Linux updating troubleshooting (64.8%)
- How to protect web server on Kali Linux from unauthorized access (63.9%)
- VirtualBox Guest Additions do not work in Kali Linux anymore (small screen, no shared clipboard) (SOLVED) (58.2%)
- Introduction to IPv6 Addresses: How to Use and How to Explore the Network (Part 2) (RANDOM - 9.6%)
While trying to install Mutillidae and DVWA I've gotten to this point where I only see blank for the localhost/mutillidae and /DVWA pages. I've followed this guide and still only see blank.
Here are the two errors associated. I've verified my php-mysqli install is good and don't really know where to progress.
Hello! What distributive do you run? I cannot reproduce the issue in the last Kali Linux.
Please check, does your OS have the files:
I'm running Kali 2019.1. I'm also missing the /usr/share/php7.3-mysql/mysql/mysqli.ini file. My directory stops at /usr/share/php7.3-mysql/
Worked properly for me :
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.4
Codename: kali-rolling