Jump to: navigation, search

OPS335 Lab 6

15 bytes removed, 15:12, 10 October 2018
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>
$mysqli = new mysqli("localhost", "<user>", "<password", "database>");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;

Navigation menu