How to work with embedded mysql from php.

How to work with embedded mysql from php.

am 20.09.2009 10:40:01 von Nishshanka Sirisena

--00504502cc0199d8b50473fe4fd3
Content-Type: text/plain; charset=ISO-8859-1

Hi all.

I am developing a peer to peer application which is written in C for windows
platform and which contains a web interface using php and html stuffs. In
this case for the application I am using embedded mysql library as the
database. Now I have a big problem because I have no Idea about How to
access and manage this embedded mysql database from php.

Please someone help me to recover from this problem.

--00504502cc0199d8b50473fe4fd3--

Re: How to work with embedded mysql from php.

am 20.09.2009 13:25:27 von Tommy Pham

--- On Sun, 9/20/09, Nishshanka Sirisena wrote:

> From: Nishshanka Sirisena
> Subject: [PHP] How to work with embedded mysql from php.
> To: php-general@lists.php.net
> Date: Sunday, September 20, 2009, 3:40 AM
> Hi all.
>
> I am developing a peer to peer application which is written
> in C for windows
> platform and which contains a web interface using php and
> html stuffs. In
> this case for the application I am using embedded mysql
> library as the
> database. Now I have a big problem because I have no Idea
> about How to
> access and manage this embedded mysql database from php.
>
> Please someone help me to recover from this problem.
>

Did you try MySQL or MySQLi libs from PHP? What are you using to connect?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: How to work with embedded mysql from php.

am 20.09.2009 18:22:19 von Tommy Pham

>
>From: Nishshanka Sirisena
>To: Tommy Pham
>Sent: Sunday, September 20, 2009 7:13:02 AM
>Subject: Re: [PHP] How to work with embedded mysql from php.
>
>>I tried with Mysqli using mysqli_server_init() and mysql_server_end() functions and I am using Lighttpd as my web server. But when I'm running the page error log of the lighttpd web server listed following error. And I have correctly configured lighttpd-php and mysql.
>
>PHP Fatal error: Call to undefined function mysqli_server_init() in
> C:\lighttpd\htdocs\web\test_db.php on line 27
>
>2009-09-20 09:02:58: (mod_fastcgi.c.1452)
>>2009-09-20 09:02:58: (connections.c.764) missing cleanup in fastcgi
>
>I have no previous experience to use this So please can somebody send me a simple implementation of this issue.
>

Nishshanka,

What version and bitness of PHP are you using? Did you compile it? Have you tried connecting to a non embedded MySQL to ensure the configuration of Lighttpd + PHP is correct? I had breakage of some apps when PHP is configured as CGI/FASTCGI and didn't bother using it as such. Note: If you didn't build both, you need to match right Visual Studio version of PHP with Lightthpd. Mix match is very bad... Official PHP releases are available in VS6 & VS9 only.

What version of embedded MySQL are you using? Check the phpinfo() to see if MySQL/MySQLi is using MySQLnd driver. MySQLnd cannot connect to MySQL 4.1+ using old authentication. It may look something like this in phpinfo():
Client API version: mysqlnd 5.0.5-dev - 081106 - $Revision: 286739 $
(This is my build of PHP-5.3.2-dev x64 running with my build of Apache 2.2.13 x64 on Win2008 x64.)

You may have to download the PHP source, do some hacking and then compile it against embedded MySQL's lib/dll. Look for HAVE_EMBEDDED_MYSQL in PHP's source code files in ext\mysql and ext\mysqli. After you hack the PHP's source code, you should be able to connect the embedded with this or something similar in PHP:

$mysql = mysql_init();
mysql_options($mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, null);
mysql_real_connect($mysql, null,null,null, "database1", 0,null,0);

Of course, depending on your requirement, the other alternative and easy fix is use a non embedded and bind the server to 127.0.0.1. You'll also don't have to deal with the limitations of embedded ;). http://dev.mysql.com/doc/refman/5.1/en/libmysqld-restriction s.html

Regards,
Tommy


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: How to work with embedded mysql from php.

am 20.09.2009 18:39:48 von Tommy Pham

----- Original Message ----
> From: Tommy Pham
> To: general php
> Sent: Sunday, September 20, 2009 9:22:19 AM
> Subject: Re: [PHP] How to work with embedded mysql from php.
>
> >
> >From: Nishshanka Sirisena
> >To: Tommy Pham
> >Sent: Sunday, September 20, 2009 7:13:02 AM
> >Subject: Re: [PHP] How to work with embedded mysql from php.
> >
> >>I tried with Mysqli using mysqli_server_init() and mysql_server_end()
> functions and I am using Lighttpd as my web server. But when I'm running the
> page error log of the lighttpd web server listed following error. And I have
> correctly configured lighttpd-php and mysql.
> >
> >PHP Fatal error: Call to undefined function mysqli_server_init() in
> >
> C:\lighttpd\htdocs\web\test_db.php on line 27
> >
> >2009-09-20 09:02:58: (mod_fastcgi.c.1452)
> >>2009-09-20 09:02:58: (connections.c.764) missing cleanup in fastcgi
> >
> >I have no previous experience to use this So please can somebody send me a
> simple implementation of this issue.
> >
>
> Nishshanka,
>
> What version and bitness of PHP are you using? Did you compile it? Have you
> tried connecting to a non embedded MySQL to ensure the configuration of Lighttpd
> + PHP is correct? I had breakage of some apps when PHP is configured as
> CGI/FASTCGI and didn't bother using it as such. Note: If you didn't build both,
> you need to match right Visual Studio version of PHP with Lightthpd. Mix match
> is very bad... Official PHP releases are available in VS6 & VS9 only.
>
> What version of embedded MySQL are you using? Check the phpinfo() to see if
> MySQL/MySQLi is using MySQLnd driver. MySQLnd cannot connect to MySQL 4.1+ using
> old authentication. It may look something like this in phpinfo():
> Client API version: mysqlnd 5.0.5-dev - 081106 - $Revision: 286739 $
> (This is my build of PHP-5.3.2-dev x64 running with my build of Apache 2.2.13
> x64 on Win2008 x64.)
>
> You may have to download the PHP source, do some hacking and then compile it
> against embedded MySQL's lib/dll. Look for HAVE_EMBEDDED_MYSQL in PHP's source
> code files in ext\mysql and ext\mysqli. After you hack the PHP's source code,
> you should be able to connect the embedded with this or something similar in
> PHP:
>
> $mysql = mysql_init();
> mysql_options($mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, null);
> mysql_real_connect($mysql, null,null,null, "database1", 0,null,0);
>
> Of course, depending on your requirement, the other alternative and easy fix is
> use a non embedded and bind the server to 127.0.0.1. You'll also don't have to
> deal with the limitations of embedded ;).
> http://dev.mysql.com/doc/refman/5.1/en/libmysqld-restriction s.html
>
> Regards,
> Tommy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

I just downloaded LightTPD (Win32) - SSL 1.4.23-1. It seems like it was built using cygwin and
"PHP-Support
```````````
- same speed as or faster than apache + mod_php4
- handles various PHP bugs in the FastCGI SAPI
- includes a utility to spawn FastCGI processes (necessary for PHP 4.3.x)"

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php