Reputation: 1231
I'm using the Google Cloud Compute Engine and I have uploaded some files for a wesbite. When I try to access a php page on my website that uses
<?php
$mysqli = new mysqli("host", "username", "pw", "dbname");
?>
The browser gives an error saying the page isnt working followed by a HTTP Error 500
Any other php is fine, I've tried echo and making random functions, they all work. It's just this mysqli error
Upvotes: 0
Views: 145
Reputation: 61
your questions details is not enough for detect yours problems,when you got HTTP Error 500
means an error happened and you need to turn on error reporting
in PHP.
you can turn on php error reporting by many ways,one of them by include error_reporting(E_ALL);
in your PHP script, before the mysqli call. This will produce the diagnostic information in the log file needed to get to an answer for this question. When you have this information, please include the information.
as @MichaelGaskill said.
Upvotes: 0
Reputation: 1231
Found the problem, turns out you have to install mysqlnd
separately with the command below
sudo apt-get install php5-mysqlnd
After the restart apache with
sudo /etc/init.d/apache2 restart
This got it working for me by running the commands in the google cloud ssh console
Upvotes: 1