Re: [PHP] Why is PHP Segmentation Faulting?!?!?!?

2004-06-21 Thread Curt Zirzow
* Thus wrote Jeff:
 Hey all
 
 Total PHP newbie here. I posted a day ago about php working
 'intermittently'. I was told to check my apache logs which was a good hint
 cause php is seg faulting. I've broken it down to my connection script to my
 database and I ran it in gdb to see if it would tell me anything. Since I am
 linux-tarded I don't have any clue what the problem is.

well, you're not that l-tarded if you know how to obtain a
backtrace :)


There are a lot of variables that are contributing to this
behaviour. 

  1. You're OS and Version
  2. Mysql Version
  3. PHP version.

 Here is the backtrace
 
 (gdb) bt
 #0  0x4207492e in _int_free () from /lib/tls/libc.so.6
 #1  0x42073908 in free () from /lib/tls/libc.so.6
 #2  0x0812b20d in _efree ()
 #3  0x40962a35 in _close_mysql_link (rsrc=0x0)
 at /usr/src/redhat/BUILD/php-4.2.2/ext/mysql/php_mysql.c:253

This answers 1 and 2.

and by the version of php your using, which happens to be almost 2
years old, You've probably have redhat 3.x installed.

So, at this point I can only tell you to upgrade you're php. But.. if
you installed mysql with an rpm you'll probably want to upgrade
mysql as well.

now how to do that.. is a whole nother ball park, iirc, that has
been answered recently on the list.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Why is PHP Segmentation Faulting?!?!?!?

2004-06-20 Thread Marek Kilimajer
Jeff wrote --- napsal::
Hey all
Total PHP newbie here. I posted a day ago about php working
'intermittently'. I was told to check my apache logs which was a good hint
cause php is seg faulting. I've broken it down to my connection script to my
database and I ran it in gdb to see if it would tell me anything. Since I am
linux-tarded I don't have any clue what the problem is.


WTF is the problem. I have a feeling my script sucks and I am doing
something totally stupid
The problem is certainly not in your script, php should handle 
gracefully any code. You did not mention what php version you are using, 
try to upgrade to the latest version and see if it helps. Also try to 
run your script with another php installation, if that helps recompile 
your own installation.

The script works fine here, php-5.0.0RC3
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Why is PHP Segmentation Faulting?!?!?!?

2004-06-19 Thread Jeff
Hey all

Total PHP newbie here. I posted a day ago about php working
'intermittently'. I was told to check my apache logs which was a good hint
cause php is seg faulting. I've broken it down to my connection script to my
database and I ran it in gdb to see if it would tell me anything. Since I am
linux-tarded I don't have any clue what the problem is.

Here is my php code!!! It is stored in a file called dbConnect.php

?PHP
//DEFINE GLOBAL VARIABLES TO BE USED BY ALL DATABASE FUNCTIONS
global $g_dbConn;

function dbConnect($HostName, $UserName, $Password)
{
 global $g_dbConn;
 if($HostName  $UserName  $Password)
 {
   print($HostName);
   print($UserName);
   print($Password);
   $g_dbConn = mysql_connect($HostName, $UserName, $Password);
   if($g_dbConn)
 {

   print(\n . $g_dbConn);
   mysql_select_db(dba,$g_dbConn);
   print(\npast select\n);
 }
 }
}

function dbIsConnected()
{
 if($GLOBALS[g_dbConn])
 {
  return true;
 }
 else
 {
  return false;
 }
}

print(start\n);
dbConnect(localhost, root, CantSeeThis);
print(finish\n);
?


Here is the output in GDB!!!
(gdb) run dbConnect.php
Starting program: /usr/bin/php dbConnect.php
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...[New Thread 1080622560 (LWP 29396)]
X-Powered-By: PHP/4.2.2
Content-type: text/html

start
localhostrootCantSeeThis
Resource id #1
past select
finish


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1080622560 (LWP 29396)]
0x4207492e in _int_free () from /lib/tls/libc.so.6



Here is the backtrace

(gdb) bt
#0  0x4207492e in _int_free () from /lib/tls/libc.so.6
#1  0x42073908 in free () from /lib/tls/libc.so.6
#2  0x0812b20d in _efree ()
#3  0x40962a35 in _close_mysql_link (rsrc=0x0)
at /usr/src/redhat/BUILD/php-4.2.2/ext/mysql/php_mysql.c:253
#4  0x081407f2 in list_entry_destructor ()
#5  0x0813f3c8 in zend_hash_clean ()
#6  0x0813f46c in zend_hash_graceful_reverse_destroy ()
#7  0x081409bf in zend_destroy_rsrc_list ()
#8  0x081320fd in shutdown_executor ()
#9  0x0813a145 in zend_deactivate ()
#10 0x0806f078 in php_request_shutdown ()
#11 0x0806d5d5 in main ()
#12 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
(gdb)



WTF is the problem. I have a feeling my script sucks and I am doing
something totally stupid

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



[PHP] Why is PHP Segmentation Faulting?!?!?!? --- ANOTHER HINT

2004-06-19 Thread Jeff
I don't know if this helps... but when I comment out all of the print
functions it seg faults at a totally different spot...

SCRIPT!!!

?PHP
//DEFINE GLOBAL VARIABLES TO BE USED BY ALL DATABASE FUNCTIONS
global $g_dbConn;

function dbConnect($HostName, $UserName, $Password)
{
 global $g_dbConn;
 if($HostName  $UserName  $Password)
 {
   //print($HostName);
   //print($UserName);
   //print($Password);
   $g_dbConn = mysql_connect($HostName, $UserName, $Password);
   if($g_dbConn)
 {

   //print(\n . $g_dbConn);
   mysql_select_db(dba,$g_dbConn);
   //print(\npast select\n);
 }
 }
}

function dbIsConnected()
{
 if($GLOBALS[g_dbConn])
 {
  return true;
 }
 else
 {
  return false;
 }
}

//print(start\n);
dbConnect(localhost, root, CantSeeThis);
//print(finish\n);
?



GDB RUN!!!

(gdb) run dbConnect.php
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/php dbConnect.php
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...
(no debugging symbols found)...(no debugging symbols found)...(no debugging
symbols found)...[New Thread 1080622560 (LWP 29412)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1080622560 (LWP 29412)]
0x4207441c in _int_malloc () from /lib/tls/libc.so.6
(gdb)



BACKTRACE

(gdb) bt
#0  0x4207441c in _int_malloc () from /lib/tls/libc.so.6
#1  0x4207378d in malloc () from /lib/tls/libc.so.6
#2  0x409caa4a in my_malloc () from /lib/libmysqlclient.so.12
#3  0x409db73a in vio_new () from /lib/libmysqlclient.so.12
#4  0x409c71bb in mysql_real_connect () from /lib/libmysqlclient.so.12
#5  0x40963161 in php_mysql_do_connect (ht=0, return_value=0x8221604,
this_ptr=0x0,
return_value_used=1, persistent=0)
at /usr/src/redhat/BUILD/php-4.2.2/ext/mysql/php_mysql.c:662
#6  0x40963d9e in zif_mysql_connect (ht=1108554344, return_value=0x42133268,
this_ptr=0x42133268, return_value_used=1108554344)
at /usr/src/redhat/BUILD/php-4.2.2/ext/mysql/php_mysql.c:714
#7  0x0815355c in execute ()
#8  0x081532ce in execute ()
#9  0x0813a7c6 in zend_execute_scripts ()
#10 0x080705ca in php_execute_script ()
#11 0x0806d648 in main ()
#12 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
(gdb)

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