MySQL not working with PHP, Segmentation fault (11)
| From: | Derek M Wickersham | Date: | Sat, 12 Apr 2003 14:46:59 +0000 |
| Subject: | MySQL not working with PHP, Segmentation fault (11) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27040@lists.php.net to get a copy of this message | ||
An all-too-familiar problem: PHP is not working with MySQL.
The httpd error log gets these in it whenever I try a mysql_connect():
[notice] child pid 3223 exit signal Segmentation fault (11)
The config:
PHP 4.1.2 installed from RPM
MySQL 4.0.12 installed from RPM
Apache 1.3.27 installed from RPM
Redhat 8.0
I also have the following PHP components installed:
php-odbc-4.1.2-7.3.6
php-mysql-4.1.2-7.3.6
php-imap-4.1.2-7.3.6
php-pgsql-4.1.2-7.3.6
php-ldap-4.1.2-7.3.6
php-devel-4.1.2-7.3.6
MySQL by itself works fine, and PHP without using MySQL seems to be
working fine too.
If I load the <? phpinfo() ?> page, I do see the section on mysql
support, and it says it is enabled.
But when I run the following code, nothing is returned to the browser,
and I get the seg fault error:
<?
@ $db = mysql_connect("localhost", "XXXXXX", "YYYYYY");
if (!$db) {
echo "database connection error";
exit;
}
?>
There is one tidbit worth mentioning. When I installed the RPM
php-mysql-4.1.2-7.3.6.i386.rpm, it said this:
warning: php-mysql-4.1.2-7.3.6.i386.rpm: V3 DSA signature: NOKEY, key
ID db42a60e
error: Failed dependencies:
libmysqlclient.so.10 is needed by php-mysql-4.1.2-7.3.6
So I created a soft link like this:
/usr/lib/libmysqlclient.so.10 -> libmysqlclient.so.12.0.0
And then re-ran the RPM installed like this:
rpm -Uvh --nodeps php-mysql-4.1.2-7.3.6.i386.rpm
The mysql.so file is present:
ls -al /usr/lib/php4
total 1668
drwxr-xr-x 2 root root 4096 Apr 12 09:23 .
drwxr-xr-x 83 root root 45056 Apr 10 15:34 ..
-rwxr-xr-x 1 root root 1453338 Sep 26 2002 imap.so
-rwxr-xr-x 1 root root 42069 Sep 26 2002 ldap.so
-rwxr-xr-x 1 root root 43338 Sep 26 2002 mysql.so
-rwxr-xr-x 1 root root 60102 Sep 26 2002 odbc.so
-rwxr-xr-x 1 root root 42868 Sep 26 2002 pgsql.so
The contents of my httpd.conf, with respect to PHP:
..
<IfDefine HAVE_PHP>
LoadModule php_module modules/mod_php.so
</IfDefine>
<IfDefine HAVE_PHP3>
LoadModule php3_module modules/libphp3.so
</IfDefine>
<IfDefine HAVE_PHP4>
LoadModule php4_module modules/libphp4.so
</IfDefine>
..
<IfDefine HAVE_PHP>
AddModule mod_php.c
</IfDefine>
<IfDefine HAVE_PHP3>
AddModule mod_php3.c
</IfDefine>
<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>
..
<IfModule mod_php4.c>
AddType application/x-httpd-php .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>
<IfModule mod_php3.c>
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
</IfModule>
<IfModule mod_php.c>
AddType application/x-httpd-php .phtml
</IfModule>
Thanks for your assistance!
--
___|o__\_____
..\( )______( )\ derek m wickersham | dwNOSPAM@mtco.com