932
edits
Changes
m
→Test Connection to MySQL Database Server
# Re-start the web-server and try to access the page from another machine. Make sure that you can '''not''' do so before you continue.
# Install the '''php-mysql''' module so that the installation of php your web server is using can execute sql statements. You will have to restart the service after installing it.
#Modify the index.php page in your private directory to match the code below. This will test that your web server can connect to the database (replace the <user, > and <password, and database > with values appropriate for your machine):<br><source>
<?php
$mysqli = new mysqli("localhost", "<user>", "<password", "database>");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;