Re: MySQL and PHP
| From: | Jon | Date: | Wed, 17 Aug 2005 16:32:10 +0000 |
| Subject: | Re: MySQL and PHP | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-26270@lists.php.net to get a copy of this message | ||
Well I ended up with a slightly different way to do it but it seems to work
for me.
Don't know if anyone else will find it useful but here is the code.
//Use windows netstat to check for port 3306 (MySQL)
//If it is not in the list then run MySQL
exec ('netstat -a -n', $reply, $error);
$reply = implode($reply);
$mysqlrunning = eregi( ':3306',$reply );
if (!$mysqlrunning){
exec
('C:\mysql\bin\mysqld.exe --defaults-file=C:\mysql\bin\my.cnf --standalone')
;
}
""Jon"" <jonraston@hotmail.com> wrote in message
news:1D.BF.33075.B7043034@pb1.pair.com...
> Is there some way to have PHP test if MySQL is running and if not make the
> system call to start it?
>
> This is just an ME test machine but I would also like to know how on XP
PRO
> cause I have another test machine available.