Re: [PHP-DB] mysql_connect(): Lost connection to MySQL server during query

2008-08-12 Thread Evert Lammerts
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html should get you
started. Good luck!

On Tue, Aug 12, 2008 at 8:27 AM, Manoj Singh <[EMAIL PROTECTED]> wrote:
> Hello all,
> I am getting this error when connecting to the database through
> mysql_connect function.
>
> Error: mysql_connect() [ href='function.mysql-connect'>function.mysql-connect]: Lost connection
> to MySQL server during query
>
> I am getting this error when the db server has the high load.
>
> Please help me out to fix this error.
>
> Best Regards,
> Manoj Kumar SIngh
>

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



Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Manysh
Awesome... that worked! The PHPIniDir was pointing to my earlier
installation. Thanks Matt and Jon! Your help is much appreciated.
Jon, thanks for sending the script.
Manysh


On Sat, Mar 8, 2008 at 9:57 PM, Matt Anderton <[EMAIL PROTECTED]> wrote:
> httpd.conf should have something like this:
>
> PHPIniDir "C:/Program Files/PHP/"
> LoadModule php5_module "C:/Program Files/PHP/php5apache2.dll"
> AddType application/x-httpd-php .php
>
> ... but all that should have been taken care of by the PHP installer.
>
> -- matt
>
>
>
> On Sat, Mar 8, 2008 at 9:16 PM, Manysh <[EMAIL PROTECTED]> wrote:
>
> > Matt - you're right! I did the manual install and its "partially"
> > working now. I say partially because it works fine when I run it from
> > the command window however when I run it from the web browser I get a
> > blank page. I restarted Apache but that didn't help. The script is
> > pasted below. Am I missing from the Apache side now? I have configured
> > http.conf too... is there anything else I need to take care of?
> > Thanks
> >
> > 
> >  > /*- DATABASE CONNECTION INFO-*/
> > $hostname="localhost";
> > $mysql_login="testuser";
> > $mysql_password="testuser";
> >
> >
> > echo "Connected successfully yet? Probably not.";
> >
> > $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > if (!$link) {
> >//die('Could not connect: ' . mysql_error());
> >echo "Some problem here";
> > }
> > else
> >echo "Connected?";
> >
> > $dbname = 'sampleapp';
> > $dbselect = @mysql_select_db($dbname);
> >
> > if ($dbselect)
> >echo "Connected to the database";
> > else
> >echo "Still not connected to the database";
> > mysql_close($link);
> > ?>
> >
> >
> >
> >
> > On Sat, Mar 8, 2008 at 7:22 PM, Matt Anderton <[EMAIL PROTECTED]> wrote:
> > > Manysh -- maybe you missed the MySQL extension installation?
> > >
> > > 2nd or 3rd screen in the setup process there is a list of extensions --
> none
> > > of them are installed by default.
> > >
> > > Your manual method of creating the 'ext' directory is a step in the
> right
> > > direction, but you probably have a missing directive or two in your
> php.ini.
> > >
> > > something like...
> > > [PHP_MYSQL]
> > > extension=php_mysql.dll
> > >
> > > but there may be some other directives you are missing - port numbers,
> etc.
> > > best to just reinstall.
> > >
> > > -- matt
> > >
> > >
> > >
> > >
> > >  On Sat, Mar 8, 2008 at 5:53 PM, Manysh <[EMAIL PROTECTED]> wrote:
> > > > Thanks for your input, Jon. Few more observations...
> > > >
> > > > Yes, I have PHP+Apache+MySQL installed for private use. I am just
> > > > trying to connect to the database successfully first and will create
> > > > other users when I make a successful connection. I made the changes as
> > > > below and still cannot connect to the database. The echo "After
> > > > connecting to the database..." is not in an if statement. I modified
> > > > the script to make it real simple for me
> > > >
> > > > I found this document:
> > > > http://www.artfulsoftware.com/php_mysql_win.html which outlines
> > > > installation and configuration steps for MySQL and PHP. Unfortunately,
> > > > I can't get it to work. One thing I noticed is that my PHP
> > > > inatallation didn't have any "ext" directory so I manually created one
> > > > and copied php_mysqli.dll to this directory and restarted my computer.
> > > > It didn't work still. Any comments/ideas?
> > > > 
> > > >  > > > /*- DATABASE CONNECTION INFO-*/
> > > > $hostname="localhost";
> > > > $mysql_login="admin";
> > > > $mysql_password="admin";
> > > >
> > > > echo "Connected successfully yet? Probably not.";
> > > >
> > > > $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > > > if (!$link) {
> > > >//die('Could not connect: ' . mysql_error());
> > > >echo "Some problem here";
> > > > }
> > > > else
> > > >echo "Connected?";
> > > >
> > > > $dbname = 'sampleapp';
> > > > $dbselect = @mysql_select_db($dbname);
> > > >
> > > > if ($dbselect)
> > > >echo "Connected to the database";
> > > > else
> > > >echo "Still not connected to the database";
> > > > mysql_close($link);
> > > > ?>
> > > > 
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Sat, Mar 8, 2008 at 3:07 PM, Jon L. <[EMAIL PROTECTED]> wrote:
> > > > > Since you seem to want to handle the errors yourself, you may try
> using
> > > the
> > > > > @ operator on the mysql functions.
> > > > > It'll silence any errors or warning that the functions might usually
> > > > > generate; but, of course, you'll be left to test for errors
> yourself.
> > > > >
> > > > >
> > > > >   $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > > > >
> > > > >   @mysql_select_db($dbname);
> > > > >
> > > > > With that, the following statement should return any errors that
> MySQL
> > > would
> > > > > otherwise generate:
> > > > >
> > > > >
> > > > >   if (!$link) {
> 

Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Matt Anderton
httpd.conf should have something like this:

PHPIniDir "C:/Program Files/PHP/"
LoadModule php5_module "C:/Program Files/PHP/php5apache2.dll"
AddType application/x-httpd-php .php

... but all that should have been taken care of by the PHP installer.

-- matt

On Sat, Mar 8, 2008 at 9:16 PM, Manysh <[EMAIL PROTECTED]> wrote:

> Matt - you're right! I did the manual install and its "partially"
> working now. I say partially because it works fine when I run it from
> the command window however when I run it from the web browser I get a
> blank page. I restarted Apache but that didn't help. The script is
> pasted below. Am I missing from the Apache side now? I have configured
> http.conf too... is there anything else I need to take care of?
> Thanks
> 
>  /*- DATABASE CONNECTION INFO-*/
> $hostname="localhost";
> $mysql_login="testuser";
> $mysql_password="testuser";
>
> echo "Connected successfully yet? Probably not.";
>
> $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> if (!$link) {
>//die('Could not connect: ' . mysql_error());
>echo "Some problem here";
> }
> else
>echo "Connected?";
>
> $dbname = 'sampleapp';
> $dbselect = @mysql_select_db($dbname);
>
> if ($dbselect)
>echo "Connected to the database";
> else
>echo "Still not connected to the database";
> mysql_close($link);
> ?>
>
>  On Sat, Mar 8, 2008 at 7:22 PM, Matt Anderton <[EMAIL PROTECTED]>
> wrote:
> > Manysh -- maybe you missed the MySQL extension installation?
> >
> > 2nd or 3rd screen in the setup process there is a list of extensions --
> none
> > of them are installed by default.
> >
> > Your manual method of creating the 'ext' directory is a step in the
> right
> > direction, but you probably have a missing directive or two in your
> php.ini.
> >
> > something like...
> > [PHP_MYSQL]
> > extension=php_mysql.dll
> >
> > but there may be some other directives you are missing - port numbers,
> etc.
> > best to just reinstall.
> >
> > -- matt
> >
> >
> >
> >
> >  On Sat, Mar 8, 2008 at 5:53 PM, Manysh <[EMAIL PROTECTED]> wrote:
> > > Thanks for your input, Jon. Few more observations...
> > >
> > > Yes, I have PHP+Apache+MySQL installed for private use. I am just
> > > trying to connect to the database successfully first and will create
> > > other users when I make a successful connection. I made the changes as
> > > below and still cannot connect to the database. The echo "After
> > > connecting to the database..." is not in an if statement. I modified
> > > the script to make it real simple for me
> > >
> > > I found this document:
> > > http://www.artfulsoftware.com/php_mysql_win.html which outlines
> > > installation and configuration steps for MySQL and PHP. Unfortunately,
> > > I can't get it to work. One thing I noticed is that my PHP
> > > inatallation didn't have any "ext" directory so I manually created one
> > > and copied php_mysqli.dll to this directory and restarted my computer.
> > > It didn't work still. Any comments/ideas?
> > > 
> > >  > > /*- DATABASE CONNECTION INFO-*/
> > > $hostname="localhost";
> > > $mysql_login="admin";
> > > $mysql_password="admin";
> > >
> > > echo "Connected successfully yet? Probably not.";
> > >
> > > $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > > if (!$link) {
> > >//die('Could not connect: ' . mysql_error());
> > >echo "Some problem here";
> > > }
> > > else
> > >echo "Connected?";
> > >
> > > $dbname = 'sampleapp';
> > > $dbselect = @mysql_select_db($dbname);
> > >
> > > if ($dbselect)
> > >echo "Connected to the database";
> > > else
> > >echo "Still not connected to the database";
> > > mysql_close($link);
> > > ?>
> > > 
> > >
> > >
> > >
> > >
> > >
> > > On Sat, Mar 8, 2008 at 3:07 PM, Jon L. <[EMAIL PROTECTED]> wrote:
> > > > Since you seem to want to handle the errors yourself, you may try
> using
> > the
> > > > @ operator on the mysql functions.
> > > > It'll silence any errors or warning that the functions might usually
> > > > generate; but, of course, you'll be left to test for errors
> yourself.
> > > >
> > > >
> > > >   $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > > >
> > > >   @mysql_select_db($dbname);
> > > >
> > > > With that, the following statement should return any errors that
> MySQL
> > would
> > > > otherwise generate:
> > > >
> > > >
> > > >   if (!$link) {
> > > > die (mysql_error());
> > > >   }
> > > >
> > > >
> > > > Now, I don't see any reason for the 2nd echo (i.e., echo " After
> > connecting
> > > > to the database...";) to not be called.
> > > > Is it in an if statement or other structure/scope in your actual
> script?
> > > >
> > > > However, I do see a reason for another to never be called:
> > > >
> > > >
> > > >   if (!$link) {
> > > > die('Could not connect: ' . mysql_error());
> > > > echo "Some problem here";
> > > >   }
> > > >
> > > > Once you call 

Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Manysh
Matt - you're right! I did the manual install and its "partially"
working now. I say partially because it works fine when I run it from
the command window however when I run it from the web browser I get a
blank page. I restarted Apache but that didn't help. The script is
pasted below. Am I missing from the Apache side now? I have configured
http.conf too... is there anything else I need to take care of?
Thanks



On Sat, Mar 8, 2008 at 7:22 PM, Matt Anderton <[EMAIL PROTECTED]> wrote:
> Manysh -- maybe you missed the MySQL extension installation?
>
> 2nd or 3rd screen in the setup process there is a list of extensions -- none
> of them are installed by default.
>
> Your manual method of creating the 'ext' directory is a step in the right
> direction, but you probably have a missing directive or two in your php.ini.
>
> something like...
> [PHP_MYSQL]
> extension=php_mysql.dll
>
> but there may be some other directives you are missing - port numbers, etc.
> best to just reinstall.
>
> -- matt
>
>
>
>
>  On Sat, Mar 8, 2008 at 5:53 PM, Manysh <[EMAIL PROTECTED]> wrote:
> > Thanks for your input, Jon. Few more observations...
> >
> > Yes, I have PHP+Apache+MySQL installed for private use. I am just
> > trying to connect to the database successfully first and will create
> > other users when I make a successful connection. I made the changes as
> > below and still cannot connect to the database. The echo "After
> > connecting to the database..." is not in an if statement. I modified
> > the script to make it real simple for me
> >
> > I found this document:
> > http://www.artfulsoftware.com/php_mysql_win.html which outlines
> > installation and configuration steps for MySQL and PHP. Unfortunately,
> > I can't get it to work. One thing I noticed is that my PHP
> > inatallation didn't have any "ext" directory so I manually created one
> > and copied php_mysqli.dll to this directory and restarted my computer.
> > It didn't work still. Any comments/ideas?
> > 
> >  > /*- DATABASE CONNECTION INFO-*/
> > $hostname="localhost";
> > $mysql_login="admin";
> > $mysql_password="admin";
> >
> > echo "Connected successfully yet? Probably not.";
> >
> > $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > if (!$link) {
> >//die('Could not connect: ' . mysql_error());
> >echo "Some problem here";
> > }
> > else
> >echo "Connected?";
> >
> > $dbname = 'sampleapp';
> > $dbselect = @mysql_select_db($dbname);
> >
> > if ($dbselect)
> >echo "Connected to the database";
> > else
> >echo "Still not connected to the database";
> > mysql_close($link);
> > ?>
> > 
> >
> >
> >
> >
> >
> > On Sat, Mar 8, 2008 at 3:07 PM, Jon L. <[EMAIL PROTECTED]> wrote:
> > > Since you seem to want to handle the errors yourself, you may try using
> the
> > > @ operator on the mysql functions.
> > > It'll silence any errors or warning that the functions might usually
> > > generate; but, of course, you'll be left to test for errors yourself.
> > >
> > >
> > >   $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> > >
> > >   @mysql_select_db($dbname);
> > >
> > > With that, the following statement should return any errors that MySQL
> would
> > > otherwise generate:
> > >
> > >
> > >   if (!$link) {
> > > die (mysql_error());
> > >   }
> > >
> > >
> > > Now, I don't see any reason for the 2nd echo (i.e., echo " After
> connecting
> > > to the database...";) to not be called.
> > > Is it in an if statement or other structure/scope in your actual script?
> > >
> > > However, I do see a reason for another to never be called:
> > >
> > >
> > >   if (!$link) {
> > > die('Could not connect: ' . mysql_error());
> > > echo "Some problem here";
> > >   }
> > >
> > > Once you call die, script execution discontinues.
> > > The echo after it will never be called, either by !$link returning false
> to
> > > if or by die being called first.
> > >
> > >
> > > On another note...
> > > This sounds like you have PHP & MySQL installed for private use.
> > > But, even if that's the case, I don't recommend connecting to the admin
> > > account unless you really need to.
> > >
> > > You should check out the following page on adding users:
> > > http://dev.mysql.com/doc/refman/5.0/en/adding-users.html
> > >
> > > And read up on the following commands:
> > > CREATE USER: http://dev.mysql.com/doc/refman/5.0/en/create-user.html
> > > GRANT: http://dev.mysql.com/doc/refman/5.0/en/grant.html
> > >
> > > - Jon L.
> > >
> > >
> > >
> > > On Sat, Mar 8, 2008 at 1:36 PM, Manysh <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I am trying to make a connection to the MySQL database from PHP but it
> > > > seems like I am missing a step or something and hence cannot connect
> > > > to the database. I have tried everything but I can't figure out why.
> > > > Please suggest/help (I am a beginner in PHP/MySQL/Apache).
> > > >
> > > > I am using M

Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Jon L.
Sorry. I can't really help you with server and PHP installation and
configuration issues.
I use XAMPP w/ a separate installation of MySQL.
http://www.apachefriends.org/en/xampp.html


But, find the following in your php.ini:
extension_dir=...
extension=php_mysql.dll

You may already have an "ext/" folder, just not where you were thinking it'd
be.
And, the extension may be commented out (semicolon at the beginning of the
line).
Theoretically, you should've recieved an "undefined function" error if it
was commented.

If the folder that extension_dir points to is empty or undefined, then I'd
say go download the Windows ZIP and rebuild the folder.



As for the script, do you have an example output?

If you're up for it, I wrote test script that outputs a few more details.



The output should be something like this:

PHP: 5.2.5

Connecting to (MySQL) localhost (user: admin)

Status: i:0; (Resource id #2)
Error : '' (0)

Server: 5.0.45-community-nt
Host  : localhost via TCP/IP

Select database `sampleapp`

Status: b:1; (1)
Error : '' (0)

Closing connection

Status: b:1; (1)
Error : '' ()

- Jon L.

On Sat, Mar 8, 2008 at 5:53 PM, Manysh <[EMAIL PROTECTED]> wrote:

> Thanks for your input, Jon. Few more observations...
>
> Yes, I have PHP+Apache+MySQL installed for private use. I am just
> trying to connect to the database successfully first and will create
> other users when I make a successful connection. I made the changes as
> below and still cannot connect to the database. The echo "After
> connecting to the database..." is not in an if statement. I modified
> the script to make it real simple for me
>
> I found this document:
> http://www.artfulsoftware.com/php_mysql_win.html which outlines
> installation and configuration steps for MySQL and PHP. Unfortunately,
> I can't get it to work. One thing I noticed is that my PHP
> inatallation didn't have any "ext" directory so I manually created one
> and copied php_mysqli.dll to this directory and restarted my computer.
> It didn't work still. Any comments/ideas?
> 
>  /*- DATABASE CONNECTION INFO-*/
> $hostname="localhost";
> $mysql_login="admin";
> $mysql_password="admin";
>
> echo "Connected successfully yet? Probably not.";
>
> $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> if (!$link) {
>//die('Could not connect: ' . mysql_error());
>echo "Some problem here";
> }
> else
>echo "Connected?";
>
> $dbname = 'sampleapp';
> $dbselect = @mysql_select_db($dbname);
>
> if ($dbselect)
>echo "Connected to the database";
> else
>echo "Still not connected to the database";
> mysql_close($link);
> ?>
> 
>
>
>
>
>
> On Sat, Mar 8, 2008 at 3:07 PM, Jon L. <[EMAIL PROTECTED]> wrote:
> > Since you seem to want to handle the errors yourself, you may try using
> the
> > @ operator on the mysql functions.
> > It'll silence any errors or warning that the functions might usually
> > generate; but, of course, you'll be left to test for errors yourself.
> >
> >
> >   $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> >
> >   @mysql_select_db($dbname);
> >
> > With that, the following statement should return any errors that MySQL
> would
> > otherwise generate:
> >
> >
> >   if (!$link) {
> > die (mysql_error());
> >   }
> >
> >
> > Now, I don't see any reason for the 2nd echo (i.e., echo " After
> connecting
> > to the database...";) to not be called.
> > Is it in an if statement or other structure/scope in your actual script?
> >
> > However, I do see a reason for another to never be called:
> >
> >
> >   if (!$link) {
> > die('Could not connect: ' . mysql_error());
> > echo "Some problem here";
> >   }
> >
> > Once you call die, script execution discontinues.
> > The echo after it will never be called, either by !$link returning false
> to
> > if or by die being called first.
> >
> >
> > On another note...
> > This sounds like you have PHP & MySQL installed for private use.
> > But, even if that's the case, I don't recommend connecting to the admin
> > account unless you really need to.
> >
> > You should check out the following page on adding users:
> > http://dev.mysql.com/doc/refman/5.0/en/adding-users.html
> >
> > And read up on the following commands:
> > CREATE USER: http://dev.mysql.com/doc/refman/5.0/en/create-user.html
> > GRANT: http://dev.mysql.com/doc/refman/5.0/en/grant.html
> >
> > - Jon L.
> >
> >
> >
> > On Sat, Mar 8, 2008 at 1:36 PM, Manysh <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > Hi,
> > >
> > > I am trying to make a connection to the MySQL database from PHP but it
> > > seems like I am missing a step or something and hence cannot connect
> > > to the database. I have tried everything but I can't figure out why.
> > > Please suggest/help (I am a beginner in PHP/MySQL/Apache).
> > >
> > > I am using MySQL 5.0.51a-community-nt on my Windows

Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Matt Anderton
Manysh -- maybe you missed the MySQL extension installation?

2nd or 3rd screen in the setup process there is a list of extensions -- none
of them are installed by default.

Your manual method of creating the 'ext' directory is a step in the right
direction, but you probably have a missing directive or two in your php.ini.

something like...
[PHP_MYSQL]
extension=php_mysql.dll

but there may be some other directives you are missing - port numbers, etc.
best to just reinstall.

-- matt


On Sat, Mar 8, 2008 at 5:53 PM, Manysh <[EMAIL PROTECTED]> wrote:

> Thanks for your input, Jon. Few more observations...
>
> Yes, I have PHP+Apache+MySQL installed for private use. I am just
> trying to connect to the database successfully first and will create
> other users when I make a successful connection. I made the changes as
> below and still cannot connect to the database. The echo "After
> connecting to the database..." is not in an if statement. I modified
> the script to make it real simple for me
>
> I found this document:
> http://www.artfulsoftware.com/php_mysql_win.html which outlines
> installation and configuration steps for MySQL and PHP. Unfortunately,
> I can't get it to work. One thing I noticed is that my PHP
> inatallation didn't have any "ext" directory so I manually created one
> and copied php_mysqli.dll to this directory and restarted my computer.
> It didn't work still. Any comments/ideas?
> 
>  /*- DATABASE CONNECTION INFO-*/
> $hostname="localhost";
> $mysql_login="admin";
> $mysql_password="admin";
>
> echo "Connected successfully yet? Probably not.";
>
> $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> if (!$link) {
>//die('Could not connect: ' . mysql_error());
>echo "Some problem here";
> }
> else
>echo "Connected?";
>
> $dbname = 'sampleapp';
> $dbselect = @mysql_select_db($dbname);
>
> if ($dbselect)
>echo "Connected to the database";
> else
>echo "Still not connected to the database";
> mysql_close($link);
> ?>
> 
>
>
>
>
>
> On Sat, Mar 8, 2008 at 3:07 PM, Jon L. <[EMAIL PROTECTED]> wrote:
> > Since you seem to want to handle the errors yourself, you may try using
> the
> > @ operator on the mysql functions.
> > It'll silence any errors or warning that the functions might usually
> > generate; but, of course, you'll be left to test for errors yourself.
> >
> >
> >   $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
> >
> >   @mysql_select_db($dbname);
> >
> > With that, the following statement should return any errors that MySQL
> would
> > otherwise generate:
> >
> >
> >   if (!$link) {
> > die (mysql_error());
> >   }
> >
> >
> > Now, I don't see any reason for the 2nd echo (i.e., echo " After
> connecting
> > to the database...";) to not be called.
> > Is it in an if statement or other structure/scope in your actual script?
> >
> > However, I do see a reason for another to never be called:
> >
> >
> >   if (!$link) {
> > die('Could not connect: ' . mysql_error());
> > echo "Some problem here";
> >   }
> >
> > Once you call die, script execution discontinues.
> > The echo after it will never be called, either by !$link returning false
> to
> > if or by die being called first.
> >
> >
> > On another note...
> > This sounds like you have PHP & MySQL installed for private use.
> > But, even if that's the case, I don't recommend connecting to the admin
> > account unless you really need to.
> >
> > You should check out the following page on adding users:
> > http://dev.mysql.com/doc/refman/5.0/en/adding-users.html
> >
> > And read up on the following commands:
> > CREATE USER: http://dev.mysql.com/doc/refman/5.0/en/create-user.html
> > GRANT: http://dev.mysql.com/doc/refman/5.0/en/grant.html
> >
> > - Jon L.
> >
> >
> >
> > On Sat, Mar 8, 2008 at 1:36 PM, Manysh <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > Hi,
> > >
> > > I am trying to make a connection to the MySQL database from PHP but it
> > > seems like I am missing a step or something and hence cannot connect
> > > to the database. I have tried everything but I can't figure out why.
> > > Please suggest/help (I am a beginner in PHP/MySQL/Apache).
> > >
> > > I am using MySQL 5.0.51a-community-nt on my Windows XP machine. PHP
> > > version used is 5.2 and Apache version is 2.2.
> > >
> > > Code Snippet:
> > >
> > > $hostname="localhost";
> > > $mysql_login="admin";
> > > $mysql_password="admin";
> > > //$database="sampleapp";
> > >
> > > echo "Print this..."; // THIS MESSAGE IS PRINTED
> > >
> > > $link = mysql_connect($hostname,$mysql_login,$mysql_password);
> > >
> > > echo " After connecting to the database..."; // THIS DOES NOT PRINT
> > > if (!$link) {
> > > die (mysql_error()); // NOR THIS ONE
> > > }
> > >
> > > $dbname = 'sampleapp';
> > > mysql_select_db($dbname);
> > >
> > > echo $link;
> > >
> > > if (!$link) {
> > >die('Could not connect: ' . mysql_error());
> > >echo "Some problem here...

Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Manysh
Thanks for your input, Jon. Few more observations...

Yes, I have PHP+Apache+MySQL installed for private use. I am just
trying to connect to the database successfully first and will create
other users when I make a successful connection. I made the changes as
below and still cannot connect to the database. The echo "After
connecting to the database..." is not in an if statement. I modified
the script to make it real simple for me

I found this document:
http://www.artfulsoftware.com/php_mysql_win.html which outlines
installation and configuration steps for MySQL and PHP. Unfortunately,
I can't get it to work. One thing I noticed is that my PHP
inatallation didn't have any "ext" directory so I manually created one
and copied php_mysqli.dll to this directory and restarted my computer.
It didn't work still. Any comments/ideas?








On Sat, Mar 8, 2008 at 3:07 PM, Jon L. <[EMAIL PROTECTED]> wrote:
> Since you seem to want to handle the errors yourself, you may try using the
> @ operator on the mysql functions.
> It'll silence any errors or warning that the functions might usually
> generate; but, of course, you'll be left to test for errors yourself.
>
>
>   $link = @mysql_connect($hostname,$mysql_login,$mysql_password);
>
>   @mysql_select_db($dbname);
>
> With that, the following statement should return any errors that MySQL would
> otherwise generate:
>
>
>   if (!$link) {
> die (mysql_error());
>   }
>
>
> Now, I don't see any reason for the 2nd echo (i.e., echo " After connecting
> to the database...";) to not be called.
> Is it in an if statement or other structure/scope in your actual script?
>
> However, I do see a reason for another to never be called:
>
>
>   if (!$link) {
> die('Could not connect: ' . mysql_error());
> echo "Some problem here";
>   }
>
> Once you call die, script execution discontinues.
> The echo after it will never be called, either by !$link returning false to
> if or by die being called first.
>
>
> On another note...
> This sounds like you have PHP & MySQL installed for private use.
> But, even if that's the case, I don't recommend connecting to the admin
> account unless you really need to.
>
> You should check out the following page on adding users:
> http://dev.mysql.com/doc/refman/5.0/en/adding-users.html
>
> And read up on the following commands:
> CREATE USER: http://dev.mysql.com/doc/refman/5.0/en/create-user.html
> GRANT: http://dev.mysql.com/doc/refman/5.0/en/grant.html
>
> - Jon L.
>
>
>
> On Sat, Mar 8, 2008 at 1:36 PM, Manysh <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Hi,
> >
> > I am trying to make a connection to the MySQL database from PHP but it
> > seems like I am missing a step or something and hence cannot connect
> > to the database. I have tried everything but I can't figure out why.
> > Please suggest/help (I am a beginner in PHP/MySQL/Apache).
> >
> > I am using MySQL 5.0.51a-community-nt on my Windows XP machine. PHP
> > version used is 5.2 and Apache version is 2.2.
> >
> > Code Snippet:
> >
> > $hostname="localhost";
> > $mysql_login="admin";
> > $mysql_password="admin";
> > //$database="sampleapp";
> >
> > echo "Print this..."; // THIS MESSAGE IS PRINTED
> >
> > $link = mysql_connect($hostname,$mysql_login,$mysql_password);
> >
> > echo " After connecting to the database..."; // THIS DOES NOT PRINT
> > if (!$link) {
> > die (mysql_error()); // NOR THIS ONE
> > }
> >
> > $dbname = 'sampleapp';
> > mysql_select_db($dbname);
> >
> > echo $link;
> >
> > if (!$link) {
> >die('Could not connect: ' . mysql_error());
> >echo "Some problem here";
> > }
> > //echo 'Connected successfully';
> > mysql_close($link);
> > ?>
> >
> > Any help is appreciated.
> > Thanks,
> > Manysh
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>

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



Re: [PHP-DB] mysql_connect() Help

2008-03-08 Thread Jon L.
Since you seem to want to handle the errors yourself, you may try using the
@ operator on the mysql functions.
It'll silence any errors or warning that the functions might usually
generate; but, of course, you'll be left to test for errors yourself.

  $link = @mysql_connect($hostname,$mysql_login,$mysql_password);

  @mysql_select_db($dbname);

With that, the following statement should return any errors that MySQL would
otherwise generate:

  if (!$link) {
die (mysql_error());
  }


Now, I don't see any reason for the 2nd echo (i.e., echo " After connecting
to the database...";) to not be called.
Is it in an if statement or other structure/scope in your actual script?

However, I do see a reason for another to never be called:

  if (!$link) {
die('Could not connect: ' . mysql_error());
echo "Some problem here";
  }

Once you call die, script execution discontinues.
The echo after it will never be called, either by !$link returning false to
if or by die being called first.


On another note...
This sounds like you have PHP & MySQL installed for private use.
But, even if that's the case, I don't recommend connecting to the admin
account unless you really need to.

You should check out the following page on adding users:
http://dev.mysql.com/doc/refman/5.0/en/adding-users.html

And read up on the following commands:
CREATE USER: http://dev.mysql.com/doc/refman/5.0/en/create-user.html
GRANT: http://dev.mysql.com/doc/refman/5.0/en/grant.html

- Jon L.

On Sat, Mar 8, 2008 at 1:36 PM, Manysh <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I am trying to make a connection to the MySQL database from PHP but it
> seems like I am missing a step or something and hence cannot connect
> to the database. I have tried everything but I can't figure out why.
> Please suggest/help (I am a beginner in PHP/MySQL/Apache).
>
> I am using MySQL 5.0.51a-community-nt on my Windows XP machine. PHP
> version used is 5.2 and Apache version is 2.2.
>
> Code Snippet:
>
> $hostname="localhost";
> $mysql_login="admin";
> $mysql_password="admin";
> //$database="sampleapp";
>
> echo "Print this..."; // THIS MESSAGE IS PRINTED
>
> $link = mysql_connect($hostname,$mysql_login,$mysql_password);
>
> echo " After connecting to the database..."; // THIS DOES NOT PRINT
> if (!$link) {
> die (mysql_error()); // NOR THIS ONE
> }
>
> $dbname = 'sampleapp';
> mysql_select_db($dbname);
>
> echo $link;
>
> if (!$link) {
>die('Could not connect: ' . mysql_error());
>echo "Some problem here";
> }
> //echo 'Connected successfully';
> mysql_close($link);
> ?>
>
> Any help is appreciated.
> Thanks,
> Manysh
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


RE: [PHP-DB] mysql_connect($server,$user,$password);

2005-07-27 Thread Miguel Guirao


Remember that PHP is a server-side scripting language, so all PHP code is
parsed at the server side and you will never see the code but the results,
second, the .php files should have permissions that do not allow direct
acces to them, but thru the   web browser!!

So, basically there is no problem with those parameters used to connect to
the DB

Chicolinux

-Original Message-
From: Chuck Han [mailto:[EMAIL PROTECTED]
Sent: Miércoles, 27 de Julio de 2005 03:41 p.m.
To: php-db@lists.php.net
Subject: [PHP-DB] mysql_connect($server,$user,$password);


Much of the password discussion I've seen revolves around encrypting the
user-supplied password, but what about the user/password used to make the
initial connection?  In other words, I'm assuming that the .php file has the
initial user and password right in the text in order to make the connection.
Is there a way around this, because it seems very insecure to me that these
parameters would be in the .php source.  Or is the .php source supposedly
not readable?

thanks, Chuck

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


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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



Re: [PHP-DB] mysql_connect() with a multi-file format

2005-06-22 Thread Chris Ramsay
> I read in the php.net manual that the connection closes automatically
> when the script exits.  Does this mean I can't open a db connection in
> one file and pass the link around from function to function?

No, the script you include becomes part of the main script calling the
inclusion, therefore the connection stays open 'til you explicitly
close it, or your main script exits.

cheers

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



Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Mulo Emmanuel
Did not see any attachment...?  The upgrade might have been the 
problem.  You might need to recompile or reinstall php...

Christian Schlaefcke wrote:
This looks like it is enabled. I recently upgraded mysql to version
4.1.4. Maybe this causes the problem. Do I have to reinstall PHP it is
still the version I got with the installation of my distro (Fedora Core
2).
I attached what phpinfo produced...
Am Mo, den 13.09.2004 um 17:20 Uhr +0300 schrieb Mulo Emmanuel:
 

Look at the phpinfo() page and see whether you find a section with 
information on MySQL.  If it isnt there, it is likely to do with the way 
you compiled AMP.

Christian Schlaefcke wrote:
   

Am Mo, den 13.09.2004 um 9:27 Uhr -0400 schrieb John Holmes: 

 

From: "Christian Schlaefcke" <[EMAIL PROTECTED]>
  

   

This is what I have in my php.ini
error_reporting  =  E_ALL
display_errors = On


 

Have you looked at a phpinfo() page to ensure you're editing the correct 
php.ini?


In the first block, it tells you what php.ini file PHP is using. If it just 
lists a directory, then that's where PHP expects to find the php.ini file.

---John Holmes... 
  

   

Yupp! And its 'is' the correct one.

 

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

 


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

Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Christian Schlaefcke
This looks like it is enabled. I recently upgraded mysql to version
4.1.4. Maybe this causes the problem. Do I have to reinstall PHP it is
still the version I got with the installation of my distro (Fedora Core
2).

I attached what phpinfo produced...

Am Mo, den 13.09.2004 um 17:20 Uhr +0300 schrieb Mulo Emmanuel:
> Look at the phpinfo() page and see whether you find a section with 
> information on MySQL.  If it isnt there, it is likely to do with the way 
> you compiled AMP.
> 
> Christian Schlaefcke wrote:
> 
> > Am Mo, den 13.09.2004 um 9:27 Uhr -0400 schrieb John Holmes: 
> >  
> >
> >>From: "Christian Schlaefcke" <[EMAIL PROTECTED]>
> >>
> >>
> >>
> >>>This is what I have in my php.ini
> >>>
> >>>error_reporting  =  E_ALL
> >>>display_errors = On
> >>>  
> >>>
> >>Have you looked at a phpinfo() page to ensure you're editing the correct 
> >>php.ini?
> >>
> >>
> >>
> >>In the first block, it tells you what php.ini file PHP is using. If it just 
> >>lists a directory, then that's where PHP expects to find the php.ini file.
> >>
> >>---John Holmes... 
> >>
> >>
> >
> >Yupp! And its 'is' the correct one.
> >
> >  
> >
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Mulo Emmanuel
Look at the phpinfo() page and see whether you find a section with 
information on MySQL.  If it isnt there, it is likely to do with the way 
you compiled AMP.

Christian Schlaefcke wrote:
Am Mo, den 13.09.2004 um 9:27 Uhr -0400 schrieb John Holmes: 
 

From: "Christian Schlaefcke" <[EMAIL PROTECTED]>
   

This is what I have in my php.ini
error_reporting  =  E_ALL
display_errors = On
 

Have you looked at a phpinfo() page to ensure you're editing the correct 
php.ini?


In the first block, it tells you what php.ini file PHP is using. If it just 
lists a directory, then that's where PHP expects to find the php.ini file.

---John Holmes... 
   

Yupp! And its 'is' the correct one.
 


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

Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Christian Schlaefcke
 Am Mo, den 13.09.2004 um 9:27 Uhr -0400 schrieb John Holmes: 
> From: "Christian Schlaefcke" <[EMAIL PROTECTED]>
> 
> > This is what I have in my php.ini
> >
> > error_reporting  =  E_ALL
> > display_errors = On
> 
> Have you looked at a phpinfo() page to ensure you're editing the correct 
> php.ini?
> 
> 
> 
> In the first block, it tells you what php.ini file PHP is using. If it just 
> lists a directory, then that's where PHP expects to find the php.ini file.
> 
> ---John Holmes... 

Yupp! And its 'is' the correct one.

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



Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread John Holmes
From: "Christian Schlaefcke" <[EMAIL PROTECTED]>
This is what I have in my php.ini
error_reporting  =  E_ALL
display_errors = On
Have you looked at a phpinfo() page to ensure you're editing the correct 
php.ini?


In the first block, it tells you what php.ini file PHP is using. If it just 
lists a directory, then that's where PHP expects to find the php.ini file.

---John Holmes... 

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


Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Christian Schlaefcke
This is what I have in my php.ini

error_reporting  =  E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = On
html_errors = On

Tried both:
error_log = /var/log/php_err.log
error_log = syslog

Nothing appears in /var/log/messages (Yes IÂm using Linux) nor in /var/
log/php_err.log

Even on the page still no errors get displayed.

Regards,

Chris

Am Mo, den 13.09.2004 um 13:29 Uhr +0100 schrieb Mark Boyle:
> If you have access to your php.ini file, take a look for the Error
> Reporting settings. It may be set to none, to to log the errors to
> syslogd or a file.
> 
> Mark
> 
> 
> On Mon, 13 Sep 2004 12:48:33 +0200, Christian Schlaefcke
> <[EMAIL PROTECTED]> wrote:
> > Hi Folks,
> > 
> > I have a problem getting a php script running. It seems that the script
> > just dies when calling the function mysql_connect("host", "username",
> > "passwd"). I put two debugging echoes (one in front and one afterwards)
> > in the script but only the first one appears.
> > 
> > There are no errormessages. How can I debug this problem?
> > 
> > PHP Version 4.3.8
> > Option "--with-mysql=shared,/usr" is set.
> > 
> > Thanks & Regards,
> > 
> > Christian
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> >
> 

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



Re: [PHP-DB] mysql_connect dies silently

2004-09-13 Thread Mark Boyle
If you have access to your php.ini file, take a look for the Error
Reporting settings. It may be set to none, to to log the errors to
syslogd or a file.

Mark


On Mon, 13 Sep 2004 12:48:33 +0200, Christian Schlaefcke
<[EMAIL PROTECTED]> wrote:
> Hi Folks,
> 
> I have a problem getting a php script running. It seems that the script
> just dies when calling the function mysql_connect("host", "username",
> "passwd"). I put two debugging echoes (one in front and one afterwards)
> in the script but only the first one appears.
> 
> There are no errormessages. How can I debug this problem?
> 
> PHP Version 4.3.8
> Option "--with-mysql=shared,/usr" is set.
> 
> Thanks & Regards,
> 
> Christian
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



Re: [PHP-DB] mysql_connect problem

2004-02-02 Thread Miles Thompson
At 03:42 PM 2/2/2004 +0100, DiZEM PGC wrote:
I try connecting to an existing mysql DB. The first time I directly called
mysql_connect with all required
params (Path/Database,User,Password) and established a connection without
problems.
Second time I have used a script that includes a self-written class
containing a few Database functions.
One of these functions, named 'db_login', does exactly the same as
mysql_connect (w. the same params). First case (directly calling) works 
fine. The
second case doesn't report any error and doesn't establish a connection.
What could be the reason for this strange behavior ?
DiZEM


Echo the mysql_error and mysql_errno as found here:
http://www.php.ca/mysql_error
Also echo the connect string so you can see exactly what's being sent. I'd 
bet on a misplaced quotation mark.

Cheers - Miles

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


Re: [PHP-DB] mysql_connect error

2003-06-10 Thread Rasmus Lerdorf
You have to load the extension in your php.ini file.  eg.

 extension=mysql.so

-Rasmus

On Tue, 10 Jun 2003, Sparky Kopetzky wrote:

> Good afternoon!
>
> I have Apache w/php installed on one server. I have mysql installed on a windows 
> machine. I keep getting this error
> 'Call to undefined function: mysql_connect()' in my php script. Now, according to 
> what the Redhat RPM is telling me about php-mysql is that I have to have mysql 
> RUNNING on the web server just so I can talk to the other windows server. That 
> doesn't make any darned sense!!! PHP runs perfectly on the web server until it hits 
> the mysql code.
>
> What am I missing here as I'm REALLY dumb when it comes to Linux.
>
> Robin E. Kopetzky
> Black Mesa Computers/Internet Services
> www.blackmesa-isp.net
>
>

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



Re: [PHP-DB] mysql_connect error

2003-06-10 Thread Sparky Kopetzky
Says right here from phpinfo under configure command:

'--with-mysql=shared,/usr'

So it HAS to be in there...

Robin

- Original Message -
From: "CPT John W. Holmes" <[EMAIL PROTECTED]>
To: "Sparky Kopetzky" <[EMAIL PROTECTED]>; "PHP DB Group"
<[EMAIL PROTECTED]>
Sent: Tuesday, June 10, 2003 13:48
Subject: Re: [PHP-DB] mysql_connect error


> PHP was not compiled with MySQL support. Re-compile.
>
> ---John Holmes...
>
> - Original Message -
> From: "Sparky Kopetzky" <[EMAIL PROTECTED]>
> To: "PHP DB Group" <[EMAIL PROTECTED]>
> Sent: Tuesday, June 10, 2003 3:35 PM
> Subject: [PHP-DB] mysql_connect error
>
>
> Good afternoon!
>
> I have Apache w/php installed on one server. I have mysql installed on a
> windows machine. I keep getting this error
> 'Call to undefined function: mysql_connect()' in my php script. Now,
> according to what the Redhat RPM is telling me about php-mysql is that I
> have to have mysql RUNNING on the web server just so I can talk to the
other
> windows server. That doesn't make any darned sense!!! PHP runs perfectly
on
> the web server until it hits the mysql code.
>
> What am I missing here as I'm REALLY dumb when it comes to Linux.
>
> Robin E. Kopetzky
> Black Mesa Computers/Internet Services
> www.blackmesa-isp.net
>
>


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



Re: [PHP-DB] mysql_connect error

2003-06-10 Thread CPT John W. Holmes
PHP was not compiled with MySQL support. Re-compile.

---John Holmes...

- Original Message - 
From: "Sparky Kopetzky" <[EMAIL PROTECTED]>
To: "PHP DB Group" <[EMAIL PROTECTED]>
Sent: Tuesday, June 10, 2003 3:35 PM
Subject: [PHP-DB] mysql_connect error


Good afternoon!

I have Apache w/php installed on one server. I have mysql installed on a
windows machine. I keep getting this error
'Call to undefined function: mysql_connect()' in my php script. Now,
according to what the Redhat RPM is telling me about php-mysql is that I
have to have mysql RUNNING on the web server just so I can talk to the other
windows server. That doesn't make any darned sense!!! PHP runs perfectly on
the web server until it hits the mysql code.

What am I missing here as I'm REALLY dumb when it comes to Linux.

Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net



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



Re: [PHP-DB] mysql_connect() problem

2003-03-17 Thread David Smith
You need to install the php-mysql rpm. You can get this on your RedHat CD,
or through apt-get:

apt-get install php-mysql

Get apt here: http://apt.freshrpms.net/

Does the PHP project ever plan to do something as impressive as CPAN so
users won't have to reinstall or recompile just to extend its
functionality?

--Dave


>
> Hi,
>
>   I am using Apache 2 in Linux 8 .Whenever in my php script I want to
> connect to mysql through mysql_connect() function a error occured.
>
> My script is like that
>   $linlid=mysql_connect("localhost","user1","user1")or
> die("Connections
> failed");
> print "Connected successfully";
>
> The script writes this.
> %
> Fatal error: Call to undefined function: mysql_connect()
>
> Please help me.I have installed Apache and php through RPM.
> Anybody can help me.
>
> Indrajit
>
>
>
>
>
> _
> Get more buddies in your list. Win prizes
> http://messenger.msn.co.in/promo
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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



Re: [PHP-DB] mysql_connect problem rh7.3

2002-11-03 Thread Wouter
Thanks!

I was able to get native mysql support by adding

	extension=mysql.so

to php.ini. So now mysql_connect() works


John Coder wrote:

While Micah is correct,  you do have mysql support on php but  as a dbs
not the built in php fuctions. Therefore you must use the dbx functions
instead.

John Coder
On Sat, 2002-11-02 at 14:35, Micah Stevens wrote:


It doesn't appear you have the PHP MySQL functions installed. When you run 
phpinfo() you should get something like:

mysql
MySQL Supportenabled
Active Persistent Links1
Active Links1
Client API version3.23.39
MYSQL_MODULE_TYPEbuiltin
MYSQL_SOCKET/var/lib/mysql/mysql.sock
MYSQL_INCLUDE
MYSQL_LIBS

The command I've always used for this during compile time is "--with-mysql" 
without any options. I'm not sure what "=shared, /tmp" does, but apparently 
it's not doing the trick.

-Micah


At 03:32 PM 11/2/2002 +0100, Wouter wrote:

Hello,

I've a rather complete php install on redhat 7.3, yet I cant't get php to 
connect to mysql. I get:

   Fatal error: Call to undefined function: mysql_connect() in
   ...

It seems that the necessary packages are installed:

[root@axon ~]# rpm -qa | grep php
php-4.1.2-7.3.4
php-mysql-4.1.2-7.3.4
asp2php-0.76.2-1
php-devel-4.1.2-7.3.4
php-ldap-4.1.2-7.3.4
php-imap-4.1.2-7.3.4
[root@axon ~]# rpm -qa | gi mysql
mysql-3.23.49-3
mysql-server-3.23.49-3
php-mysql-4.1.2-7.3.4
mysql-devel-3.23.49-3
mysqlclient9-3.23.22-6


I've attached the start of phpinfo() at the end...

Any ideas? Maybe php.ini needs some change, but I can't figure which one..

Thanks,
Wouter


PHP Version 4.1.2

System Linux stripples.devel.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 
06:41:59 EDT 2002 i686 unknown
Build Date Aug 21 2002
Configure Command  './configure' 'i386-redhat-linux' '--prefix=/usr' 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' 
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' 
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' 
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' 
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' 
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' 
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
'--with-mm' '--with-openssl' '--with-png' '--with-pspell' 
'--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' 
'--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' 
'--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' 
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' 
'--enable-yp' '--enable-wddx' '--without-oci8' '--with-imap=shared' 
'--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' 
'--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' 
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' 
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop' 
'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' 
'--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs=/usr/sbin/apxs'






dbx
dbx support enabled
dbx version 1.0.0
supported databases MySQLODBCPostgreSQLMicrosoft SQL 
ServerFrontBase









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




Re: [PHP-DB] mysql_connect problem rh7.3

2002-11-02 Thread John Coder
While Micah is correct,  you do have mysql support on php but  as a dbs
not the built in php fuctions. Therefore you must use the dbx functions
instead.

John Coder
On Sat, 2002-11-02 at 14:35, Micah Stevens wrote:
> 
> It doesn't appear you have the PHP MySQL functions installed. When you run 
> phpinfo() you should get something like:
> 
> mysql
> MySQL Supportenabled
> Active Persistent Links1
> Active Links1
> Client API version3.23.39
> MYSQL_MODULE_TYPEbuiltin
> MYSQL_SOCKET/var/lib/mysql/mysql.sock
> MYSQL_INCLUDE
> MYSQL_LIBS
> 
> The command I've always used for this during compile time is "--with-mysql" 
> without any options. I'm not sure what "=shared, /tmp" does, but apparently 
> it's not doing the trick.
> 
> -Micah
> 
> 
> At 03:32 PM 11/2/2002 +0100, Wouter wrote:
> >Hello,
> >
> >I've a rather complete php install on redhat 7.3, yet I cant't get php to 
> >connect to mysql. I get:
> >
> > Fatal error: Call to undefined function: mysql_connect() in
> > ...
> >
> >It seems that the necessary packages are installed:
> >
> >[root@axon ~]# rpm -qa | grep php
> >php-4.1.2-7.3.4
> >php-mysql-4.1.2-7.3.4
> >asp2php-0.76.2-1
> >php-devel-4.1.2-7.3.4
> >php-ldap-4.1.2-7.3.4
> >php-imap-4.1.2-7.3.4
> >[root@axon ~]# rpm -qa | gi mysql
> >mysql-3.23.49-3
> >mysql-server-3.23.49-3
> >php-mysql-4.1.2-7.3.4
> >mysql-devel-3.23.49-3
> >mysqlclient9-3.23.22-6
> >
> >
> >I've attached the start of phpinfo() at the end...
> >
> >Any ideas? Maybe php.ini needs some change, but I can't figure which one..
> >
> >Thanks,
> >Wouter
> >
> >
> >PHP Version 4.1.2
> >
> >System Linux stripples.devel.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 
> >06:41:59 EDT 2002 i686 unknown
> >Build Date Aug 21 2002
> >Configure Command  './configure' 'i386-redhat-linux' '--prefix=/usr' 
> >'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
> >'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
> >'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
> >'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
> >'--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' 
> >'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' 
> >'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' 
> >'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' 
> >'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' 
> >'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' 
> >'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
> >'--with-mm' '--with-openssl' '--with-png' '--with-pspell' 
> >'--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' 
> >'--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' 
> >'--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' 
> >'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
> >'--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' 
> >'--enable-yp' '--enable-wddx' '--without-oci8' '--with-imap=shared' 
> >'--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' 
> >'--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' 
> >'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' 
> >'--enable-memory-limit' '--enable-bcmath' '--enable-shmop' 
> >'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' 
> >'--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs=/usr/sbin/apxs'



> >dbx
> >dbx support enabled
> >dbx version 1.0.0
> >supported databases MySQLODBCPostgreSQLMicrosoft SQL 
> >ServerFrontBase
> >



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




Re: [PHP-DB] mysql_connect problem rh7.3

2002-11-02 Thread Micah Stevens

It doesn't appear you have the PHP MySQL functions installed. When you run 
phpinfo() you should get something like:

mysql
MySQL Supportenabled
Active Persistent Links1
Active Links1
Client API version3.23.39
MYSQL_MODULE_TYPEbuiltin
MYSQL_SOCKET/var/lib/mysql/mysql.sock
MYSQL_INCLUDE
MYSQL_LIBS

The command I've always used for this during compile time is "--with-mysql" 
without any options. I'm not sure what "=shared, /tmp" does, but apparently 
it's not doing the trick.

-Micah


At 03:32 PM 11/2/2002 +0100, Wouter wrote:
Hello,

I've a rather complete php install on redhat 7.3, yet I cant't get php to 
connect to mysql. I get:

Fatal error: Call to undefined function: mysql_connect() in
...

It seems that the necessary packages are installed:

[root@axon ~]# rpm -qa | grep php
php-4.1.2-7.3.4
php-mysql-4.1.2-7.3.4
asp2php-0.76.2-1
php-devel-4.1.2-7.3.4
php-ldap-4.1.2-7.3.4
php-imap-4.1.2-7.3.4
[root@axon ~]# rpm -qa | gi mysql
mysql-3.23.49-3
mysql-server-3.23.49-3
php-mysql-4.1.2-7.3.4
mysql-devel-3.23.49-3
mysqlclient9-3.23.22-6


I've attached the start of phpinfo() at the end...

Any ideas? Maybe php.ini needs some change, but I can't figure which one..

Thanks,
Wouter


PHP Version 4.1.2

System Linux stripples.devel.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 
06:41:59 EDT 2002 i686 unknown
Build Date Aug 21 2002
Configure Command  './configure' 'i386-redhat-linux' '--prefix=/usr' 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' 
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' 
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' 
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' 
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' 
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' 
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
'--with-mm' '--with-openssl' '--with-png' '--with-pspell' 
'--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' 
'--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' 
'--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' 
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' 
'--enable-yp' '--enable-wddx' '--without-oci8' '--with-imap=shared' 
'--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' 
'--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' 
'--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' 
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop' 
'--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' 
'--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs=/usr/sbin/apxs'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php.ini
ZEND_DEBUG disabled
Thread Safety disabled

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.1.1, Copyright (c) 1998-2001 Zend Technologies

PHP 4.0 Credits
Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference
On On
allow_url_fopen
1 1
always_populate_raw_post_data
0 0
arg_separator.input
& &
arg_separator.output
& &
asp_tags
Off Off
auto_append_file
no value no value
auto_prepend_file
no value no value
browscap
no value no value
default_charset
no value no value
default_mimetype
text/html text/html
define_syslog_variables
Off Off
disable_functions
no value no value
display_errors
On On
display_startup_errors
Off Off
doc_root
no value no value
enable_dl
On On
error_append_string
no value no value
error_log
no value no value
error_prepend_string
no value no value
error_reporting
2039 2039
expose_php
On On
extension_dir
/usr/lib/php4 /usr/lib/php4
file_uploads
no value no value
gpc_order
GPC GPC
highlight.bg
#FF #FF
highlight.comment
#FF9900 #FF9900
highlight.default
#CC #CC
highlight.html
#00 #00
highlight.keyword
#006600 #006600
highlight.string
#CC #CC
html_errors
On On
ignore_user_abort
Off Off
implicit_flush
Off Off
include_path
.:/usr/share/pear .:/usr/share/pear
log_errors
Off Off
magic_quotes_gpc
On On
magic_quotes_runtime
Off Off
magic_quotes_sybase
Off Off
max_execution_time
30 30
memory_limit
8M 8M
open_basedir
no value no value
output_buffering
no value no value
output_handler
no value no value
post_max_size
8M 8M
precision
14 14
register_argc_argv
On On
register_globals
On On
safe_mode
Off Off
safe_mode_exec_dir
no value no value
safe_mode_gid
Off Off
safe_mode_include_dir
no value no value
sendmail_from
[EMAIL PROTECTED] [EMAIL PROTECTED]
sendmail_path
/usr/sbin/sendmail -t -i  /usr/sbin/

Re: [PHP-DB] MySQL_connect

2002-03-06 Thread Josh Trutwin

> On Wednesday 06 March 2002 15:53, [EMAIL PROTECTED] wrote:
>
>> Hi,
>>
>> I'm new to MySql, when I try to connect my PHP-script with
>> mysql_connect($host, $user, $pass)
>> my script returns the error
>> "Fatal error: Call to undefined function: mysql_connect()"
>> I have given the user all rights in MySQL, both on host, DB, tables,
>> and fields
>>
>> This might be easy for you, but I'm stuck..any help / comments are
>> appreciated
>
> It means you do not have mysql support in PHP. If you compiled PHP
> yourself,  recompile it to include mysql support. If you installed it
> via RPM then look  for the appropriate RPMs from distro vendor.

A great way to check this is to create a simple script called phpinfo.php
with just this line in it, place it in your top level web directory:



Point your browser to http://localhost/phpinfo.php (assuming the computer
you are using is your web server)  You should see the ./configure command
used to compile PHP, look for --with-mysql.

Josh




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




Re: [PHP-DB] MySQL_connect

2002-03-06 Thread Jason Wong

On Wednesday 06 March 2002 15:53, [EMAIL PROTECTED] wrote:

> Hi,
>
> I'm new to MySql, when I try to connect my PHP-script with
> mysql_connect($host, $user, $pass)
> my script returns the error
> "Fatal error: Call to undefined function: mysql_connect()"
> I have given the user all rights in MySQL, both on host, DB, tables, and
> fields
>
> This might be easy for you, but I'm stuck..any help / comments are
> appreciated

It means you do not have mysql support in PHP. If you compiled PHP yourself, 
recompile it to include mysql support. If you installed it via RPM then look 
for the appropriate RPMs from distro vendor.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Sometime when you least expect it, Love will tap you on the shoulder...
and ask you to move out of the way because it still isn't your turn.
-- N.V. Plyter
*/

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




Re: [PHP-DB] mysql_connect()

2002-02-12 Thread Sharif Islam


Check your php install:test.php :



)
   ((
  |""|-.
  | :|/'
 -`--'-

On Tue, 12 Feb 2002, Martin Allan Jensen wrote:

> Sorry folks, last time i wrote it to fast! Well here is the hole story
>
> We got an organisation to install a new version of phpmyadmin, mySQL and PHP 4.0.6 
>on our Cobalt Raq 4r server (Linux)
>
> They got it installed and phpmyadmin is working finebut when i call fro a script 
>souch as
> %
>  // Connecting, selecting database
> $link = mysql_connect("127.0.0.10", "phpcoder_dk", "pdw")
> or die("Could not connect");
> print "Connected successfully";
> mysql_select_db("phpcoder_dk")
> or die("Could not select database");
>
> // Performing SQL query
> $query = "SELECT * FROM hits";
> $result = mysql_query($query)
> or die("Query failed");
> ?>
> %
>
> The script writes this.
> %
> Fatal error: Call to undefined function: mysql_connect() in 
>/home/sites/site2/web/sql.php on line 3
> %
>
> You can test it at http://www.phpcoder.dk/sql.php
>
> I really hope that someone will help me cause i really can't find the problem by 
>myself...!
>
> Kind regards
> Martin Allan Jensen
>


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




RE: [PHP-DB] mysql_connect()

2002-02-12 Thread Rick Emery

Re-read my previous email.  You do not have mysql functionality compiled
into PHP and you web server.  The clue is the phrase "undefined function:
mysql_connect()".
How did you load PHP, MYSQL, etc?

-Original Message-
From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 10:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql_connect()


Sorry folks, last time i wrote it to fast! Well here is the hole
story

We got an organisation to install a new version of phpmyadmin, mySQL and PHP
4.0.6 on our Cobalt Raq 4r server (Linux)

They got it installed and phpmyadmin is working finebut when i call fro
a script souch as
%

%

The script writes this.
%
Fatal error: Call to undefined function: mysql_connect() in
/home/sites/site2/web/sql.php on line 3
%

You can test it at http://www.phpcoder.dk/sql.php

I really hope that someone will help me cause i really can't find the
problem by myself...!

Kind regards
Martin Allan Jensen

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




RE: [PHP-DB] mysql_connect()

2002-02-12 Thread Rick Emery

What is the exact error you are getting?

I'm going to guess something along the lines of "unidentified function
mysql_connect()".  If that's the case, that means you do not have mysql
functionality compiled into your web server.

Speaking of which: what is your Linux system (RedHat SuSe, etc)?  What is
your web server?


-Original Message-
From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 10:09 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql_connect()


Hi all. once again i need help...

I tried a lot of  stuff but my server (linux) (php 4.0.6) won't use the
mysql_connect() command..??

Anyone else have an solution for the problem..??


Kind regards
Martin Allan Jensen

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




Re: [PHP-DB] mysql_connect() fails on redhat!

2001-05-01 Thread B. van Ouwerkerk


>When I try to connect to db with mysql_connect(,-,)
>I get undefined function : mysql_connect
>
>Do I have to include any other call for redhat 7.0 and RPM on top of my
>script to make PHP see the mysql ?
>
>Does any body know how to make Redhat PHP & MYSQL RPM work together?

ARCHIVE.. but also www.devshed.com www.phpbeginner.com and many many many 
many others.

Take a look at the tutorials.

Bye,


B.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_connect() error

2001-03-25 Thread Chad Schmidt

Never mind I figured it out!

""Chad Schmidt"" <[EMAIL PROTECTED]> wrote in message
99lqi8$u00$[EMAIL PROTECTED]">news:99lqi8$u00$[EMAIL PROTECTED]...
> I'm having problems getting php to interface with mysql on a linux server.
> I have a Linux Redhat setup and everything has been rpm'ed.  Here is the
> error I get
>
> "Fatal error: Call to undefined function: mysql_connect() in
> /var/www/html/secure/index.php4 on line 4"
>
> Thanks in advance,
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]