Hi,
I have a website in a Linux/Apache shared hosting environment and have
been given access to the MySQL server running on the same machine. To
access this database from PHP, I have to call mysql_connect(h ost,
user, password) where the password is hardcoded into my PHP source
file in clear text.
I see two security problems with this:
1) Since the PHP source is in my public webserver area, another user
of the same server could telnet into the server and look at the source
file and see the password file. I can't lock the file down using Unix
file system permissions or else the webserver won't be able to read
it.
2) If my ISP messes up their webserver config and accidentally stops
parsing PHP files and outputs the PHP file as plain text, the password
will be visible to all.
Is there any other way for PHP to authenticate itself to MySQL?
Thanks in advance!
I have a website in a Linux/Apache shared hosting environment and have
been given access to the MySQL server running on the same machine. To
access this database from PHP, I have to call mysql_connect(h ost,
user, password) where the password is hardcoded into my PHP source
file in clear text.
I see two security problems with this:
1) Since the PHP source is in my public webserver area, another user
of the same server could telnet into the server and look at the source
file and see the password file. I can't lock the file down using Unix
file system permissions or else the webserver won't be able to read
it.
2) If my ISP messes up their webserver config and accidentally stops
parsing PHP files and outputs the PHP file as plain text, the password
will be visible to all.
Is there any other way for PHP to authenticate itself to MySQL?
Thanks in advance!
Comment