Hi,

I'm getting some very strange (and nerve-wracking) behavior and hope
someone here has some ideas.

The subject says mysql_pconnect, but I get the same problem using
mysql_connect. I'm using PHP 4.2 & MySQL 3.23.44 on Red Hat 7.2

In PHP I have a simple db class that more or less serves as a wrapper to
the mysql commands. In the last couple of days mysql has arbitrarily
started refusing connections from certain sections of the script. That
is, some scripts have no problem connecting, while at other times I get
the "Access denied for user" error in PHP. A check of the database
object reveals it is identical in all cases (successful and
unsuccessful), so it's not a user/pw problem. The scripts all execute on
localhost, so it's not a permissions problem. Interestingly, phpMyAdmin
(using the same connection parameters) never has a problem.

As a further note, sometimes a script works or doesn't based on context.
I use Fusebox (http://www.fusebox.org) to break up the code into a bunch
of includes. So sometimes the script works without a hitch, other times
it doesn't.

Also, the database object is usually registered as a session variable.

I haven't tweaked any of the connection settings for either PHP or MySQL
because 1) I'm a little nervous about it and 2) this is not by any
stretch a heavily loaded box, so I assume the default settings are fine.

When I first encountered this problem I thought it might have to do with
a hanging query because I have a script that uses delayed insert, but
that didn't fix it. Further, I was able to use phpMyAdmin to view
running processes, so obviously it is connecting just fine.

I just checked again and there are 15 processes running under the same
user. Is that a lot? 

I've dumped the runtime info and system variables below, if that's any
help.

TIA,
Derek

PHP MySQL settings
mysql.allow_persistent On On 
mysql.default_host no value no value 
mysql.default_password no value no value 
mysql.default_port no value no value 
mysql.default_socket no value no value 
mysql.default_user no value no value 
mysql.max_links Unlimited Unlimited 
mysql.max_persistent Unlimited Unlimited 

RUNTIME INFO
Variable_name  Value  
Aborted_clients  0  
Aborted_connects  53  
Bytes_received  53510  
Bytes_sent  163592  
Connections  131  
Created_tmp_disk_tables  0  
Created_tmp_tables  11  
Created_tmp_files  0  
Delayed_insert_threads  1  
Delayed_writes  28  
Delayed_errors  0  
Flush_commands  1  
Handler_delete  5  
Handler_read_first  17  
Handler_read_key  154  
Handler_read_next  13  
Handler_read_prev  0  
Handler_read_rnd  130  
Handler_read_rnd_next  1220  
Handler_update  0  
Handler_write  53  
Key_blocks_used  100  
Key_read_requests  652  
Key_reads  98  
Key_write_requests  238  
Key_writes  216  
Max_used_connections  14  
Not_flushed_key_blocks  0  
Not_flushed_delayed_rows  0  
Open_tables  64  
Open_files  128  
Open_streams  0  
Opened_tables  400  
Questions  759  
Select_full_join  0  
Select_full_range_join  0  
Select_range  0  
Select_range_check  0  
Select_scan  99  
Slave_running  OFF  
Slave_open_temp_tables  0  
Slow_launch_threads  0  
Slow_queries  0  
Sort_merge_passes  0  
Sort_range  3  
Sort_rows  130  
Sort_scan  33  
Table_locks_immediate  756  
Table_locks_waited  0  
Threads_cached  0  
Threads_created  129  
Threads_connected  15  
Threads_running  1  
Uptime  5253  


SYSTEM VARIABLES
back_log  50  
basedir  /  
binlog_cache_size  32768  
character_set  latin1  
character_sets  latin1 big5 czech euc_kr gb2312 gbk sjis tis620 ujis
dec8 dos german1 hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew
win1251 estonia hungarian koi8_ukr win1251ukr greek win1250 croat cp1257
latin5  
concurrent_insert  ON  
connect_timeout  5  
datadir  /var/lib/mysql/  
delay_key_write  ON  
delayed_insert_limit  100  
delayed_insert_timeout  300  
delayed_queue_size  1000  
flush  OFF  
flush_time  0  
have_bdb  NO  
have_gemini  NO  
have_innodb  NO  
have_isam  YES  
have_raid  NO  
have_openssl  NO  
init_file    
interactive_timeout  28800  
join_buffer_size  131072  
key_buffer_size  8388600  
language  /usr/share/mysql/english/  
large_files_support  ON  
locked_in_memory  OFF  
log  OFF  
log_update  OFF  
log_bin  OFF  
log_slave_updates  OFF  
log_long_queries  OFF  
long_query_time  10  
low_priority_updates  OFF  
lower_case_table_names  0  
max_allowed_packet  1048576  
max_binlog_cache_size  4294967295  
max_binlog_size  1073741824  
max_connections  100  
max_connect_errors  10  
max_delayed_threads  20  
max_heap_table_size  16777216  
max_join_size  4294967295  
max_sort_length  1024  
max_user_connections  0  
max_tmp_tables  32  
max_write_lock_count  4294967295  
myisam_max_extra_sort_file_size  256  
myisam_max_sort_file_size  2047  
myisam_recover_options  0  
myisam_sort_buffer_size  8388608  
net_buffer_length  16384  
net_read_timeout  30  
net_retry_count  10  
net_write_timeout  60  
open_files_limit  0  
pid_file  /var/lib/mysql/server1.escalan.com.pid  
port  3306  
protocol_version  10  
record_buffer  131072  
record_rnd_buffer  131072  
query_buffer_size  0  
safe_show_database  OFF  
server_id  0  
slave_net_timeout  3600  
skip_locking  ON  
skip_networking  OFF  
skip_show_database  OFF  
slow_launch_time  2  
socket  /var/lib/mysql/mysql.sock  
sort_buffer  2097144  
sql_mode  0  
table_cache  64  
table_type  MYISAM  
thread_cache_size  0  
thread_stack  65536  
transaction_isolation  READ-COMMITTED  
timezone  CST  
tmp_table_size  33554432  
tmpdir  /tmp/  
version  3.23.44  
wait_timeout  28800  



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to