mysql_connect stops via php
mysql_connect stops via php
am 04.11.2007 09:35:46 von farhan
Hi,
Please divert me if this is not the right group to be posting this
question.
I am a Linux client trying to connect to a mysql windows server via
php, upon hitting the mysql_connect line in my php script, it simply
stops executing. In other words anything or'ed with it, like echo
does not end up in the html source. I'm not entirely sure on the
inner workings of php scripting so I can't explain why echo commands
before the mysql_connect don't show up either. However, they appear
fine when the mysql_connect line is commented out. Is it a parsing
issue?
Command line mysql connection works just fine.
phpinfo() gives correct mysql info.
apace error_log says *** glibc detected *** double free or corruption
(!prev): 0x08132138 ***
[Sun Nov 4 14:18:33 2007] [notice] child pid 2316 exit signal Aborted
(6)
Any ideas of how to go about debugging this much appreciated.
Thanks,
Farhan
Re: mysql_connect stops via php
am 04.11.2007 10:05:13 von Macca
Howz about posting your code?
Apart from that, check the settings in your php.ini file and make sure
that error reporting is turned on:
set
error_reporting = E_ALL
and
display_errors = On
restart the server and run the script again.
Re: mysql_connect stops via php
am 04.11.2007 20:36:39 von gordonb.24xpk
>I am a Linux client trying to connect to a mysql windows server via
>php, upon hitting the mysql_connect line in my php script, it simply
>stops executing. In other words anything or'ed with it, like echo
>does not end up in the html source. I'm not entirely sure on the
>inner workings of php scripting so I can't explain why echo commands
>before the mysql_connect don't show up either. However, they appear
>fine when the mysql_connect line is commented out. Is it a parsing
>issue?
Assuming you have PHP running under Apache as a module, PHP has
dumped core. This is a serious error somewhere (in PHP, Apache, or
the MySQL client library, most likely).
>Command line mysql connection works just fine.
>
>phpinfo() gives correct mysql info.
>
>apace error_log says *** glibc detected *** double free or corruption
>(!prev): 0x08132138 ***
>[Sun Nov 4 14:18:33 2007] [notice] child pid 2316 exit signal Aborted
>(6)
You might try isolating what causes the problem (for instance, does it
still blow up if you try using an incorrect password?) but debugging
PHP isn't going to be easy if you aren't familiar with PHP source code.
Perhaps you could try reinstalling PHP, all the extensions, and the MySQL
client library.
Re: mysql_connect stops via php
am 04.11.2007 23:02:00 von farhan
On Nov 4, 8:05 pm, macca wrote:
> Howz about posting your code?
>
> Apart from that, check the settings in your php.ini file and make sure
> that error reporting is turned on:
>
> set
>
> error_reporting = E_ALL
>
> and
>
> display_errors = On
>
> restart the server and run the script again.
Here it is:
$username = "root";
$password = "budget";
$database = "budget";
echo "foobar1";
$link = mysql_connect("192.168.1.100", $username, $password);
echo "foobar2";
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
?>
HTML that is generated with this script is completely blank. Thanks
for the display_errors = on tip, it is reporting errors (for other
scripts) but nothing new for this one.
Thanks again,
Farhan
Re: mysql_connect stops via php
am 05.11.2007 00:17:48 von Jerry Stuckle
farhan wrote:
> On Nov 4, 8:05 pm, macca wrote:
>> Howz about posting your code?
>>
>> Apart from that, check the settings in your php.ini file and make sure
>> that error reporting is turned on:
>>
>> set
>>
>> error_reporting = E_ALL
>>
>> and
>>
>> display_errors = On
>>
>> restart the server and run the script again.
>
> Here it is:
>
>
> $username = "root";
> $password = "budget";
> $database = "budget";
>
> echo "foobar1";
>
> $link = mysql_connect("192.168.1.100", $username, $password);
>
> echo "foobar2";
>
> if (!$link) {
> die('Could not connect: ' . mysql_error());
> }
>
> echo 'Connected successfully';
> ?>
>
> HTML that is generated with this script is completely blank. Thanks
> for the display_errors = on tip, it is reporting errors (for other
> scripts) but nothing new for this one.
>
> Thanks again,
> Farhan
>
>
How long did you wait? If, for instance, the mysql_connect() takes a
long time to time out, you could be waiting for a while. And since by
default everything will be buffered, the echo "foobar1"; wouldn't be
seen, either.
Is the mysql server available on your intranet at that address? And is
MySql running?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: mysql_connect stops via php
am 05.11.2007 01:10:45 von farhan
Hi Jerry,
I'm not sure how to control the length of time to wait other than the
timeout value for mysql.connect which phpinfo() says is 60 seconds.
Firefox seems to try for about 5 seconds (you know the browser wait
thingy) before giving up. The MySql server seems to be fine as I can
connect to it at that address and username/password via the command
line.
On a related note, I did forget to mention a bit of history. To start
with my Linux installation contained MySql 4.x but when installing on
Windows, I used 5.1. So consequently when I tried to connect from the
4.x client to the 5.1 server, it said something about not being about
to authenticate, so I downloaded 5.0 on linux and everything worked
fine on the command line. However, phpinfo() still reported the MySQL
client as 4.x. Not finding any installation scripts, I manually
copied all executables to /usr/bin and all libraries to /lib. Now
phpinfo is correct.
BTW, my php version is 4.3.10.
-Farhan
Re: mysql_connect stops via php
am 05.11.2007 02:11:33 von Jerry Stuckle
farhan wrote:
> Hi Jerry,
>
> I'm not sure how to control the length of time to wait other than the
> timeout value for mysql.connect which phpinfo() says is 60 seconds.
> Firefox seems to try for about 5 seconds (you know the browser wait
> thingy) before giving up. The MySql server seems to be fine as I can
> connect to it at that address and username/password via the command
> line.
>
But can you do it from a command line on your web server? That is, are
you running your web server on your local machine, or is it on another
one? And if it is another server, can you connect to the MySQL database
from the command line there?
> On a related note, I did forget to mention a bit of history. To start
> with my Linux installation contained MySql 4.x but when installing on
> Windows, I used 5.1. So consequently when I tried to connect from the
> 4.x client to the 5.1 server, it said something about not being about
> to authenticate, so I downloaded 5.0 on linux and everything worked
> fine on the command line. However, phpinfo() still reported the MySQL
> client as 4.x. Not finding any installation scripts, I manually
> copied all executables to /usr/bin and all libraries to /lib. Now
> phpinfo is correct.
>
> BTW, my php version is 4.3.10.
>
IOW you could still have mixed file versions - some from 4.x and some
from 5.1. That doesn't sound good.
What happens if you try to connect with an invalid userid/password
and/or to an invalid system?
> -Farhan
>
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: mysql_connect stops via php
am 05.11.2007 03:15:00 von farhan
> But can you do it from a command line on your web server? That is, are
> you running your web server on your local machine, or is it on another
> one? And if it is another server, can you connect to the MySQL database
> from the command line there?
I don't know how to use the command line of the web server - just via
the browser. Yes, the web server is running on my local machine. When
I say command line, I mean the mysql executable which I believe is a
different binary to the one the web server uses. Connecting from the
web server on which the MySQL server is running poses no problems.
> IOW you could still have mixed file versions - some from 4.x and some
> from 5.1. That doesn't sound good.
Yes, this is possible, but I don't know what other associated files
there are besides the ones in /lib and /usr/bin.
> What happens if you try to connect with an invalid userid/password
> and/or to an invalid system?
If the syntax is wrong, then I get a parser error in the apache logs.
When using wrong parameters, then the result is the same as my
original.
-Farhan
Re: mysql_connect stops via php
am 05.11.2007 03:22:28 von farhan
> But can you do it from a command line on your web server? That is, are
> you running your web server on your local machine, or is it on another
> one? And if it is another server, can you connect to the MySQL database
> from the command line there?
I don't know how to use the command line of the web server - just via
the browser. Yes, the web server is running on my local machine. When
I say command line, I mean the mysql executable which I believe is a
different binary to the one the web server uses. Connecting from the
web server on which the MySQL server is running poses no problems.
> IOW you could still have mixed file versions - some from 4.x and some
> from 5.1. That doesn't sound good.
Yes, this is possible, but I don't know what other associated files
there are besides the ones in /lib and /usr/bin.
> What happens if you try to connect with an invalid userid/password
> and/or to an invalid system?
If the syntax is wrong, then I get a parser error in the apache logs.
When using wrong parameters, then the result is the same as my
original.
-Farhan
Re: mysql_connect stops via php
am 05.11.2007 03:22:42 von farhan
> But can you do it from a command line on your web server? That is, are
> you running your web server on your local machine, or is it on another
> one? And if it is another server, can you connect to the MySQL database
> from the command line there?
I don't know how to use the command line of the web server - just via
the browser. Yes, the web server is running on my local machine. When
I say command line, I mean the mysql executable which I believe is a
different binary to the one the web server uses. Connecting from the
web server on which the MySQL server is running poses no problems.
> IOW you could still have mixed file versions - some from 4.x and some
> from 5.1. That doesn't sound good.
Yes, this is possible, but I don't know what other associated files
there are besides the ones in /lib and /usr/bin.
> What happens if you try to connect with an invalid userid/password
> and/or to an invalid system?
If the syntax is wrong, then I get a parser error in the apache logs.
When using wrong parameters, then the result is the same as my
original.
-Farhan
Re: mysql_connect stops via php
am 05.11.2007 03:23:31 von farhan
> But can you do it from a command line on your web server? That is, are
> you running your web server on your local machine, or is it on another
> one? And if it is another server, can you connect to the MySQL database
> from the command line there?
I don't know how to use the command line of the web server - just via
the browser. Yes, the web server is running on my local machine. When
I say command line, I mean the mysql executable which I believe is a
different binary to the one the web server uses. Connecting from the
web server on which the MySQL server is running poses no problems.
> IOW you could still have mixed file versions - some from 4.x and some
> from 5.1. That doesn't sound good.
Yes, this is possible, but I don't know what other associated files
there are besides the ones in /lib and /usr/bin.
> What happens if you try to connect with an invalid userid/password
> and/or to an invalid system?
If the syntax is wrong, then I get a parser error in the apache logs.
When using wrong parameters, then the result is the same as my
original.
-Farhan
Re: mysql_connect stops via php
am 05.11.2007 05:05:53 von Jerry Stuckle
farhan wrote:
>> But can you do it from a command line on your web server? That is, are
>> you running your web server on your local machine, or is it on another
>> one? And if it is another server, can you connect to the MySQL database
>> from the command line there?
>
> I don't know how to use the command line of the web server - just via
> the browser. Yes, the web server is running on my local machine. When
> I say command line, I mean the mysql executable which I believe is a
> different binary to the one the web server uses. Connecting from the
> web server on which the MySQL server is running poses no problems.
>
>> IOW you could still have mixed file versions - some from 4.x and some
>> from 5.1. That doesn't sound good.
>
> Yes, this is possible, but I don't know what other associated files
> there are besides the ones in /lib and /usr/bin.
>
>> What happens if you try to connect with an invalid userid/password
>> and/or to an invalid system?
>
> If the syntax is wrong, then I get a parser error in the apache logs.
> When using wrong parameters, then the result is the same as my
> original.
>
> -Farhan
>
>
When I asked if you could run the command line version from your web
server, I meant the machine your web server is running on - in this case
your localhost. Just trying to ensure you can access the server properly.
But if you get a problem with a double free or similar error during
runtime, it really looks like you've got multiple copies of MySQL on
your system.
And I don't know which Linux you have or how MySQL was originally
installed, so I'd have no idea where else you might have some MySQL
files. But this is the wrong newsgroup for that end, anyway - you need
comp.databases.mysql to follow up on the MySQL end.
And I think right now that's what it seems you need. I don't see any
PHP problem here right now, at least. But lots of possibilities for
MySQL problems.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: mysql_connect stops via php
am 05.11.2007 05:16:32 von farhan
Thanks for your help anyway.
-Farhan
Re: mysql_connect stops via php
am 06.11.2007 05:40:19 von AnrDaemon
Greetings, farhan.
In reply to Your message dated Monday, November 5, 2007, 01:02:00,
>
> $username = "root";
> $password = "budget";
> $database = "budget";
Do. Not. Use. ROOT. User. In. Production. Environment.
Ever.
All SUPER users in MySQL handled with special rules, different from normal
users.
--
Sincerely Yours, AnrDaemon
Re: mysql_connect stops via php
am 07.11.2007 01:38:56 von farhan
On Nov 6, 3:40 pm, AnrDaemon wrote:
> Greetings, farhan.
> In reply to Your message dated Monday, November 5, 2007, 01:02:00,
>
> >
> > $username = "root";
> > $password = "budget";
> > $database = "budget";
>
> Do. Not. Use. ROOT. User. In. Production. Environment.
> Ever.
>
> All SUPER users in MySQL handled with special rules, different from normal
> users.
>
> --
> Sincerely Yours, AnrDaemon
Yes, thank you for pointing this out, however, since this is just a
one of database strictly for home use, I figured it would be okay.
BTW, my problem was fixed by building and installing php5. I'm not
sure if upgrading to 5 fixed the problem or the fact that the building
process linked against the new libmysqlclient.so binary that I dropped
in. I would've expected the dynamic-linker to take care of this for
php4 unless it was not compatible. Either way, I'm out of the woods,
thanks to all.
-Farhan