I am a newbie to php and databases.
I followed the openSuSE LAMP guide. I installed the mariadb and phpMyAdmin . I opened a port in the firewall for a mysql database server.
In a browser (Chromium):
localhost/index.htm displays “It works”
localhost/phpinfo.php displays PHP version 7.0.7. The section for mysqli is present.
localhost/phpMyAdmin pulls up phpMyAdmin
I created a new database, created several tables and several relationships.
I created the file connectPHP.php:
<?php
//Step1
$localhost = ‘localhost’;
$username = ‘root’;
$password = ‘password’;
$database_name = ‘databaseName’;
$db = mysqli_connect($localhost,$username,$password,$database_name)
or die(‘Error connecting to MySQL server.’);
?>
– where password is the password used to get into phpMyAdmin, databaseName is the name of the database I created.
I placed this in /home/myName/public_html
localhost/~myName/connectPHP.php – gives the die message
I opened a terminal console with root privileges and copied the file into /srv/www/htdocs
localhost/connectPHP.php - also gives the die message
Any ideas? I think I am very close.
Thank you in advance