I have Ubuntu 14.04 LTS. I set up apache, phpmyadmin and mysql. I can access databases through localhost/phpmyadmin using my set password and root as username. I have put a link inside /etc/apache2/sites-enabled that links to the original .conf file of the website located in /etc/apache2/sites-available. And it has these lines (mypage.conf
php_value mysql.default.user root
php_value mysql.default.password mypass
php_value mysql.default.host localhost
When I try to connect to database using this in my index.php it works prettily:
mysql_connect('localhost', 'root', 'mypass') or die(mysql_error());
But when I try to connect to database using this below:
mysql_connect(ini_get("mysql.default.host"), ini_get("mysql.default.user"), ini_get("mysql.default.password")) or die(mysql_error());
In return it posts this error message to the page and doesn't execute the rest of the code:
Access denied for user ''@'localhost' (using password: NO)
As I can understand from this, what it gets from default values are ''. So I must be doing something wrong about the .conf file. Can you help me about it?