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