Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHP5/MySQL problem

1 view
Skip to first unread message

Joseph Mays

unread,
Jul 16, 2007, 1:20:07 PM7/16/07
to freebsd-...@freebsd.org
Been dealing with a very frustrating couple of days, and have hit a wall. I
had a working gallery2 installation, then upgraded mysqli, and all hell
broke loose.

When I try to open a page (in this case gallery2) that connects to the
database. It always says "Too many open links". The thing is, it even says
that if mysqld is not running.

I'm running under freebsd 6.1.

You can examine my server setup at http://geekfleet.tai-gear.com/server-info

You can examine the php setup at http://geekfleet.tai-gear.com/phpinfo.php

The problem I'm having now is that php5 won't connect to the mysql server.
It's not a gallery thing, I've confirmed that I have the exact same problem
with a simple script to just connect to the mysql server and read the
database. And, in fact, the exact same error occurs if mysqld is not running
at all. Apache shows --

[Mon Jul 16 02:07:10 2007] [error] [client 66.249.66.10] PHP Warning:
mysql_connect() [<a
href='function.mysql-connect'>function.mysql-connect</a>]: Too many
open links (0) in
/usr/local/www/apache22/data/gallery2/lib/adodb/drivers/adodb-mysql.in
c.php on line 366


Here is the info in php.ini --

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = Off

; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no
limit.
mysql.max_links = -1

; Default port number for mysql_connect(). If unset, mysql_connect()
will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will
only look
; at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects. If empty, uses the
built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this
file.
; *Any* user with PHP access can run 'echo
get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access
to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for
table/index scans an
d
; SQL-Errors will be displayed.
mysql.trace_mode = Off

[MySQLi]

; Maximum number of links. -1 means no limit.
mysqli.max_links = -1

; Default port number for mysqli_connect(). If unset,
mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will
only look
; at MYSQL_PORT.
mysqli.default_port = 3306

; Default socket name for local MySQL connects. If empty, uses the
built-in
; MySQL defaults.
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysqli.default_user =


; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this
file.
; *Any* user with PHP access can run 'echo
get_cfg_var("mysqli.default_pw")
; and reveal this password! And of course, any users with read access
to this
; file will be able to reveal the password as well.
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off


Shaun Cummiskey

unread,
Jul 16, 2007, 2:00:54 PM7/16/07
to Joseph Mays, freebsd-...@freebsd.org
On Mon, 16 Jul 2007 13:20:07 -0400
"Joseph Mays" <ma...@win.net> wrote:

> You can examine the php setup at http://geekfleet.tai-gear.com/phpinfo.php

It doesn't appear that your installation of PHP was compiled with MySQL
support. If you go down to the MySQL section of the phpinfo output, the
value for MYSQL_MODULE_TYPE should be either "builtin" or "external."
IIRC, PHP will build with its own native MySQL support by default;
specifying --disable-all at config time overrode that option.

I would suggest appending --with-mysql --with-mysqli to PHP's configure
command, and recompiling.

hth

Joseph Mays

unread,
Jul 16, 2007, 3:41:11 PM7/16/07
to Shaun Cummiskey, freebsd-...@freebsd.org
Okay, I did a "make deinstall; make clean; make rmconfig" in both the php5
and php5-extensions directories.

I edited the following in the php5 Makefile --

From:

CONFIGURE_ARGS= --enable-versioning \
--with-layout=GNU \
--with-config-file-scan-dir=${PREFIX}/etc/php \
--disable-all \
--enable-libxml \
--with-libxml-dir=${LOCALBASE} \
--enable-reflection \
--program-prefix=""

To:

CONFIGURE_ARGS= --enable-versioning \
--with-layout=GNU \
--with-mysql \
--with-mysqli \
--with-config-file-scan-dir=${PREFIX}/etc/php \
--disable-all \
--enable-libxml \
--with-libxml-dir=${LOCALBASE} \
--enable-reflection \
--program-prefix=""


MySQL still shows up as external in phpinfo. However, it looks like I am
getting a successful connection, now but I am getting the following error
from gallery2 --

[Mon Jul 16 20:24:59 2007] [error] [client 216.24.33.177] PHP Fatal error:
Call to undefined function preg_match() in
/usr/local/www/apache22/data/dpmeetup/index.php on line 35
[Mon Jul 16 20:25:00 2007] [error] [client 216.24.33.177] PHP Fatal error:
Call to undefined function preg_match() in
/usr/local/www/apache22/data/dpmeetup/index.php on line 35


Thanks for your help.

Berend de Boer

unread,
Jul 16, 2007, 4:49:02 PM7/16/07
to Joseph Mays, freebsd-...@freebsd.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "Joseph" == Joseph Mays <ma...@win.net> writes:

Joseph> I edited the following in the php5 Makefile

You can just say:

make config

- --
Cheers,

Berend de Boer


PS: This email has been digitally signed if you wonder what the strange
characters are that your email client displays.
PGP public key: http://www.pobox.com/~berend/berend-public-key.txt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFGm9m+IyuuaiRyjTYRAqZRAKDJ1ol9L2xG8LXier/ZOtBd5xO6zACg3Vzc
E7sG7gpr+T1ahldiPZzLGME=
=E1Fj
-----END PGP SIGNATURE-----

Momchil Ivanov

unread,
Jul 16, 2007, 5:07:51 PM7/16/07
to freebsd-...@freebsd.org, Joseph Mays
On Monday 16 July 2007 21:41:11 Joseph Mays wrote:
>
> [Mon Jul 16 20:24:59 2007] [error] [client 216.24.33.177] PHP Fatal error:
> Call to undefined function preg_match() in
> /usr/local/www/apache22/data/dpmeetup/index.php on line 35
> [Mon Jul 16 20:25:00 2007] [error] [client 216.24.33.177] PHP Fatal error:
> Call to undefined function preg_match() in
> /usr/local/www/apache22/data/dpmeetup/index.php on line 35

I guess you need the PCRE php extension.

--
PGP KeyID: 0x3118168B
Keyserver: pgp.mit.edu
Key fingerprint BB50 2983 0714 36DC D02E  158A E03D 56DA 3118 168B

Ivan Voras

unread,
Jul 18, 2007, 6:47:40 AM7/18/07
to freebsd-...@freebsd.org
Joseph Mays wrote:
> Been dealing with a very frustrating couple of days, and have hit a
> wall. I had a working gallery2 installation, then upgraded mysqli, and
> all hell broke loose.

It looks like you upgraded PHP, not only MySQL, and you're missing PHP
extensions your application needs. Try building the lang/php5-extensions
port.

signature.asc
0 new messages