For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > September 2006 > php for windows and databases









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author php for windows and databases
halex2000

2006-09-28, 3:57 am

Hi, I've read somewhere that in order to activate the support for databases,
I have to compile the source of php with a specific command. I didn't
compile the source, I simply installed the binaries for windows, and I don't
know if there is a way to connect with a db without recompiling everything
from scratch. I've just started with php, so I want to make the things easy.
Thank you.


Ron Barnett

2006-09-28, 7:57 am

"halex2000" <powernews@libero.it> wrote in message
news:GtMSg.126615$_J1.878532@twister2.libero.it...
> Hi, I've read somewhere that in order to activate the support for
> databases, I have to compile the source of php with a specific command. I
> didn't compile the source, I simply installed the binaries for windows,
> and I don't know if there is a way to connect with a db without
> recompiling everything from scratch. I've just started with php, so I want
> to make the things easy.
> Thank you.


Hi,
It does depend on where you got your distribution from, mine (from PHP.net)
have always 'worked out of the box'

If you execute a simple script
--------------------
<?PHP
echo phpinfo();
?>
------------------
you will get all the details of your configuration including which, if any
databases are supported.

Cheers

Ron


halex2000

2006-09-29, 3:57 am


"Ron Barnett" <ron.REMOVE@RJBarnett.co.uk.REMOVE> ha scritto nel messaggio
news:451bb575.0@entanet...
> "halex2000" <powernews@libero.it> wrote in message
> news:GtMSg.126615$_J1.878532@twister2.libero.it...
>
> Hi,
> It does depend on where you got your distribution from, mine (from
> PHP.net) have always 'worked out of the box'
>
> If you execute a simple script
> --------------------
> <?PHP
> echo phpinfo();
> ?>
> ------------------
> you will get all the details of your configuration including which, if any
> databases are supported.
>
> Cheers
>
> Ron
>


Thank you, but phpinfo doesn't show any support, except ODBC. I tried this
simple code to connect to the database:
<?php
require_once('DB.php');
$db = DB::connect("mysql://cignox1@localhost/cinema");
if(DB::isError($db)) {die($db->getMessage());}; ?>
but it complains that it cannot find DB.php. Where should I get it from?


Ron Barnett

2006-09-29, 3:57 am

"halex2000" <powernews@libero.it> wrote in message
news:9m4Tg.127675$zy5.1782001@twister1.libero.it...
>
> "Ron Barnett" <ron.REMOVE@RJBarnett.co.uk.REMOVE> ha scritto nel messaggio
> news:451bb575.0@entanet...
>
> Thank you, but phpinfo doesn't show any support, except ODBC. I tried this
> simple code to connect to the database:
> <?php
> require_once('DB.php');
> $db = DB::connect("mysql://cignox1@localhost/cinema");
> if(DB::isError($db)) {die($db->getMessage());}; ?>
> but it complains that it cannot find DB.php. Where should I get it from?


Hi,

I suspect from the :: that it is the PEAR DB.php you need - there is a link
to pear off the PHP.net site, probably www.pear.net or www.pear.org from
intuition.

There will be full install information but I think all you just need to have
the file in your include path - no doubt someone else will correct me if I'm
wrong.

Cheers

Ron


Schluppy

2006-09-29, 7:57 am

On Fri, 29 Sep 2006 07:57:57 +0000, halex2000 wrote:

>
> "Ron Barnett" <ron.REMOVE@RJBarnett.co.uk.REMOVE> ha scritto nel messaggio
> news:451bb575.0@entanet...
>
> Thank you, but phpinfo doesn't show any support, except ODBC. I tried this
> simple code to connect to the database:
> <?php
> require_once('DB.php');
> $db = DB::connect("mysql://cignox1@localhost/cinema");
> if(DB::isError($db)) {die($db->getMessage());}; ?>
> but it complains that it cannot find DB.php. Where should I get it from?


MySql requires an extension. You can read about using extensions on
Windows here:
http://www.php.net/manual/en/instal....extensions.php

PEAR is the "PHP Extension and Application Repository".
http://pear.php.net/

There you'll find a ton of code designed explicitly to make your life
easier -- like the DB package.

PHP is distributed with a PEAR command-line client. Once set up,
installing PEAR packages is as easy as opening a command prompt and typing
"pear install Name_Of_Package".

You can read about setting PEAR up here:
http://pear.php.net/manual/en/installation.php

--
Schluppy

Ron Barnett

2006-09-29, 7:57 am

"- no doubt someone else will correct me if I'm
> wrong.
>
> Cheers
>
> Ron

Just found it : //pear.php.net

Ron


IchBin

2006-09-29, 7:57 am

Ron Barnett wrote:
> "- no doubt someone else will correct me if I'm
> Just found it : //pear.php.net
>
> Ron
>
>


Yes you will need a include in your php.ini to run the PEAR::DB. In my
case I use smarty so I also have that added to the include.

Example:
include_path =".;C:\php\PEAR\pear;C:\Program Files\smarty\libs;"

If mysql and mysqli if you want to use it are not showing up in the
phpinfo() output then you need to add those two extensions to your php.ini.

Example (uncomment the following in your php.ini)

;extension=php_mysql.dll
;extension=php_mysqli.dll

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
________________________________________
__________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
halex2000

2006-09-29, 6:57 pm


"halex2000" <powernews@libero.it> ha scritto nel messaggio
news:GtMSg.126615$_J1.878532@twister2.libero.it...
> Hi, I've read somewhere that in order to activate the support for
> databases, I have to compile the source of php with a specific command. I
> didn't compile the source, I simply installed the binaries for windows,
> and I don't know if there is a way to connect with a db without
> recompiling everything from scratch. I've just started with php, so I want
> to make the things easy.
> Thank you.
>


Thank you all for your help: I made it working (not trivial, actually ;-),
but I apreciate your generosity.
Alessandro


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com