php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20840 Command line mysql_connect Segmentation fault
Submitted: 2002-12-05 16:10 UTC Modified: 2002-12-06 17:27 UTC
From: rb512c at motorola dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.2.3 OS: Solaris 8
Private report: No CVE-ID: None
 [2002-12-05 16:10 UTC] rb512c at motorola dot com
I have a new machine (ultra 60 solaris 8) that is running php 4.2.3 and mysql 3.23.52. 

If I run a simple mysql_connect to the database through apache (web page) it works just fine. But if I run the same file with the command line php, I get a: 
Segmentation Fault(coredump) 

If I gdb the core file I find that it failed in read_charset_index ()

(gdb) bt
#0  0xf535c in read_charset_index ()
#1  0xf5d08 in get_charset ()
#2  0xee7cc in mysql_real_connect ()
#3  0x4383c in php_mysql_do_connect (ht=2008792, return_value=0x1e1bd8, 
    this_ptr=0x0, return_value_used=0, persistent=0) at php_mysql.c:684
#4  0x439e4 in zif_mysql_connect (ht=3, return_value=0x1e1bd8, this_ptr=0x0, 
    return_value_used=1) at php_mysql.c:736
#5  0xe6f4c in execute ()
#6  0xc820c in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at zend.c:812
#7  0x2f2f0 in php_execute_script (primary_file=0xffbef3d0) at main.c:1383
#8  0x2c7f0 in main (argc=2, argv=0xffbef45c) at cgi_main.c:778
(gdb) 



If I truss the program, I see the same thing: 

open64("/usr/local/mysql/share/mysql/charsets/Index", O_RDONLY) = 6 
Incurred fault #6, FLTBOUNDS %pc = 0x000F535C 
siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008 
Received signal #11, SIGSEGV [default] 
siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008 
*** process killed *** 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-05 19:32 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-12-06 03:14 UTC] georg@php.net
Looks like your charset files are corrupted or have wrong permissions. If you don't need charset support, try to use the embedded libmysql (you don't have to specify --with-mysql for that)

 [2002-12-06 12:53 UTC] rb512c at motorola dot com
Thanks Georg!!!  Compiling without the --with-mysql got me what I needed.

However, I am curious what the problem was.  Since this works from the webpage and not from the command line.  I do not belive that there is a problem with the permissions on the charset (Index) file.  Nor do I believe it is corrupt...tried one that worked on a (MUCH) older version of php.

Also...I did not try the latest CVS copy but am curious if there was a fix in it for this problem?

Thanks for your help.
 [2002-12-06 17:27 UTC] georg@php.net
it's defintely not an error in php, it's a libmysql problem (bogus). 

I'll send a mail to bugs@lists.mysql.com and keep you up-to-date.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Jan 02 05:00:01 2026 UTC