[Wolves] PHP/MySQL help please

Simon Morris simon.morris at cmtww.com
Mon Jul 25 15:38:08 BST 2005


On Mon, 2005-07-25 at 14:20 +0100, Peter Cannon wrote:
> On Monday 25 July 2005 13:45, Simon Morris wrote:
> 
> > mysql_connect.inc is normally a small file containing your SQL
> > connection information e.g. host, username, password, database.
> 
> Yep thats the one, after creating this initial file apparently you can
> modify
> it, save it under a differant name to do other connections. Not got
> that far
> yet. :(
> 
So really you shouldn't be able to call mysql_connect.inc in a web
browser.. you should get a 404 error rather than a blank page ;)

Sounds like you should move that file up a level and not have it in your
webroot. It's a security issue rather than a purely technical issue so
your code would work where ever the file is stored.
 
> > The reason this is in a separate file and not in your main PHP code
> is
> > that you can keep this information securely out of the way of your
> web
> > root.
> 
> You got the same book as me? That paragraph is almost word perfect ;)
> 
Nope, but maybe I should start writing one!! It would be a bloody short
one. "MySQL and PHP.. on the back of a matchbox by Simon Morris"


> > You may find sometimes that Apache serves up the PHP raw code rather
> > than process the PHP script so browsers see the PHP statements. This
> > happens rarely if Apache is misconfigured but you wouldn't like your
> > database connection parameters to be shown to clients.
> 
> That did happen but I think it was more to do with it being outside
> of /htdocs
> 
> > Where is the rest of the PHP code for the accounts database? do you
> have
> > a index.php file anywhere?
> 
> Yes I cant remember the tree right now as I'm at work but I think its
> something like this;
> 
> /svr/www/htdocs/php
> 
> There is loads of php stuff in there calendar.php etc, etc.
> 
Maybe you should alter your httpd.conf file so it accepts index.php as a
valid DefaultIndex name

> > That sounds like you don't have the php4-mysql package installed
> 
> Oh yes I do along with a gazillion other php packages Yast did throw
> up some
> conflict errors but I resolved those.
> 
OK - my guess is to restart Apache then :)

~sm



More information about the Wolves mailing list