WordPress Install failed [404] - "undefined function mysql_connect()"

VPS Provider: layerstack

Virtualization Type: KVM

System: Ubuntu 20.10

Installation option:
OLS or Enterprise?
OLS

Installing from official server or mirror server?
official

Install Memcached extension for PHP?
yes

Install LiteSpeed Memcached?
yes

Install Memcached?
yes

Install Redis extension for PHP?
yes

Install Redis?
yes

Problem:
First, Hello everyone ^^,

When I try to use the One-click WordPress Installation tool I have the following error:
“Installation failed” "error:[404]
The CyberPanel logs shows more details:

Call to undefined function mysql_connect() […]wp-includes/wp-db.php:1688

“Uncaught Error: Call to undefined function mysql_connect()” wp-db.php:1688

PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/wai-zhan.net/public_html/wp-includes/wp-db.php:1688
Stack trace:
#0 /home/wai-zhan.net/public_html/wp-includes/wp-db.php(632): wpdb->db_connect()
#1 /home/wai-zhan.net/public_html/wp-includes/load.php(545): wpdb->__construct()
#2 /home/wai-zhan.net/public_html/wp-settings.php(124): require_wp_db()
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1271): require(’/home/wai-zhan…’)
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1192): WP_CLI\Runner->load_wordpress()
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#6 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(77): WP_CLI\Bootstrap\LaunchRunner->process()
#7 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()
#8 phar:///usr/bin/wp/php/boot-phar.php(11): include(‘phar:///usr/bin…’)
#9 /usr/bin/wp(4): include(‘phar:///usr/bin…’)
#10 {main}
thrown in /home/wai-zhan.net/public_html/wp-includes/wp-db.php on line 1688
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/wai-zhan.net/public_html/wp-includes/wp-db.php:1688
Stack trace:
#0 /home/wai-zhan.net/public_html/wp-includes/wp-db.php(632): wpdb->db_connect()
#1 /home/wai-zhan.net/public_html/wp-includes/load.php(545): wpdb->__construct()
#2 /home/wai-zhan.net/public_html/wp-settings.php(124): require_wp_db()
#3 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1271): require(’/home/wai-zhan…’)
#4 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1192): WP_CLI\Runner->load_wordpress()
#5 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#6 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(77): WP_CLI\Bootstrap\LaunchRunner->process()
#7 phar:///usr/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()
#8 phar:///usr/bin/wp/php/boot-phar.php(11): include(‘phar:///usr/bin…’)
#9 /usr/bin/wp(4): include(‘phar:///usr/bin…’)
#10 {main}
thrown in /home/wai-zhan.net/public_html/wp-includes/wp-db.php on line 1688
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

What I tried to fix:

I manually installed PHP 8 because I think it’s PHP related (even if the 7.4 didn’t worked neither), running (as root):
apt install lsphp80
and restarted server.

But it didn’t fixed the issue.
I’ve been able to reproduce the same issue like 3-4 times after a clean install of Ubuntu.

Would you be kind enough to help me please?

Can you please ask layerstack to contact us, because we can not reproduce this issue on our end.

My dear usmannasir,
Thanks for your answer. I appreciate your support.

I just fixed this issue. The problem wasn’t coming from Layerstack but from me😌…
I had to install CyberPanel on a fresh install of Ubuntu 20.10 because Layerstack provides only this one as pre-built Ubuntu 20 OS. But the install script doesn’t support Ubuntu 20.10 yet…

So I just replaced Ubuntu 20.04 to 20.10 inside to be able to run the installer and let it recognize the system as Ubuntu 20. Seems it wasn’t a good idea…

So I managed to install Ubuntu 20.04 from an ISO file, and now the problem is solved.

Thanks again for inquiring!

great