Bug #1465: a user-defined function reported as "unsupported or undefined"
| From: | sklar at student dot net | Date: | Fri, 28 May 1999 16:40:38 +0000 |
| Subject: | Bug #1465: a user-defined function reported as "unsupported or undefined" | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6187@lists.php.net to get a copy of this message | ||
From: sklar@student.net
Operating system: Linux 2.0.35
PHP version: 3.0.7
PHP Bug Type: Parser error
Bug description: a user-defined function reported as "unsupported or undefined"
This bug happens sporadically. I am using the module with apache 1.3.6.
It seems to happen more frequently after the child processes serve a large number
of requests, but some children can serve tons of requests with no problems.
The error I get is:
PHP 3 Fatal error: Call to unsupported or undefined function db_write() in global.php on line 30
global.php, which is required at the top of just about every page on my site begins like this:
<?php
if (!isset($GLOBAL_PHP_ALREADY_INCLUDED)) {
$GLOBAL_PHP_ALREADY_INCLUDED = 1;
$DEBUG = 0;
function db_read() {
global $DATABASE_READ;
mysql_connect($DATABASE_READ,"user","password");
mysql_select_db("dbname");
}
function db_write() {
global $DATABASE_WRITE;
mysql_pconnect($DATABASE_WRITE,"user","password");
mysql_select_db("dbname");
}
function db_other() {
global $DATABASE_OTHER;
mysql_pconnect($DATABASE_OTHER,"user","password");
mysql_select_db("dbname");
}
db_write();
-----------
and the error is happening when it gets to the db_write() call. The function has to be defined at
that point, since the code that defines it is just a few lines above the function call.
I use these db_*() functions to switch between which database server the php script is talking to as
it executes.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net