Using an online book, I’ve gotten off to a good start.
Inputing http://127.0.0.1 in my browser nets:
And clicking on this gets:
And looking for the root directory I find:
xxxx@ubuntu65:~$ sudo find / -name “apache2-default”
Turns out, though, that the default place for html is in the “www” subdirectory. I placed a test script in an got a good result from http://127.0.0.1/test.php:
Yes, I also got the two “echo” lines, but it didn’t fit in screenshot. About this table above, Janet Valade says: “Anytime that you have a question about the settings for PHP, you can use the phpinfo() statement to display this table and check a setting.”
It’s pretty cool how everything is like clockwork. Guess this is ultra-stable technology. Knock on wood!
BTW, looking in /etc/php5/apache2/php.ini there is this:
This is the default settings file for new PHP installations. By default, PHP installs itself with a configuration suitable for development purposes, and *NOT* for production purposes. For several security-oriented considerations that should be taken before going online with your site, please consult php.ini-recommended and http://php.net/manual/en/security.php.
Oops. The book says to review the listing above and check the MySQL section and I don’t see any. It’s on, then, to the passage titled “Testing MySQL.”
Well, the mysql_up.php test program abended and the book was no help.
Fatal error: Call to undefined function mysqli_connect() in /var/www/mysql_up.php on line 13
Turns out calling mysqli can only be done if a module is installed. Looked thru the package manager and found php5-mysqli (and it also needed the php5-mysql which is for older databases. Now the question is, does PHP need restarting? It’s NOT a process. I noticed that now two more lines have been added to php.ini:
I’m rebooting to see. YES! That worked (though I wish I knew what could have just been restarted.) Now I’m getting a few other errors:
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user ‘mysql’@’localhost’ (using password: NO) in /var/www/mysql_up.php on line 13Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /var/www/mysql_up.php on line 15
Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /var/www/mysql_up.php on line 18
Yes that last line WAS left hanging like that. I had changed the user name to “mysql” in mysql_up.php since that was mentioned in /etc/mysql/my.cnf I changed it back to “root” and it works! I got the lenthy table of gibberish I was suppose to.
Chapter 3 is mostly about database and application planning and design. It provides two sample scenarios. Chapter 4 has more detailed usage info and mentions how to access a mySQL database from the command line:
xxxxxxxx@ubuntu65:~$ mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 5.0.24a-Debian_9-logType ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> show databases
Now we’re talking.