In retrospect I probably should have opened this in the software forum. .my.cnf won't work for securing the database connection in a php script but here's the best solution for securing said connection (which is what I really wanted):
set the include_path in /etc/php.ini:
Code:
vi /etc/php.ini
; UNIX: "/path1:/path2"
include_path = ".:/path/to/wherever/you/choose"
create a config.php file in the path you set for includes (example: vi /usr/local/php/config.php) and enter the following:
Code:
<?php
$dbc = mysqli_connect('localhost', 'your database username' 'your database password', 'your database name') or die('Error connecting to MySQL server.');
?>
then in the top of my php script that I need to connect to the db, I entered:
Code:
include('config.php');
the include function also works for securing the wp-config.php in wordpress. create another configuration.php file in the path you set for includes (example: vi /usr/local/php/wordpressconfig.php) and enter the following:
Code:
<?php
define('DB_NAME', 'your database name');
define('DB_USER', 'your database username');
define('DB_PASSWORD', 'your database password');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
?>
edit your wp-config.php file and remove:
Code:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
/** MySQL hostname */
define('DB_HOST', 'localhost');
** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
and replace with:
Code:
include('wordpressconfig.php');