LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-10-2008, 03:20 AM   #1
Murattash
LQ Newbie
 
Registered: Dec 2008
Posts: 2

Rep: Reputation: 0
I have mysql connect error sometimes when trying to submit a form on a Open Suse 11


Dear All,

I am hosting my website on Open Suse 11 and using php, mysql and apache. I have installed all packages through Yast. My problem is that, on my website there is a form created by using PHP, and users submit data using this form to mysql server and results are shown on a different page. Most of the time users can submit using this form but I have received some e-mails saying that they get "can not connect to mysql" error. It is fairly new and there are not many users using the website however it is very annoying to receive such e-mails. I checked on different forums and tried many recommnedations however none of them fixed the problem. I have changed the settings of mysql configuration file to use more memory and connections but still no luck.. Please advise if you have any opinion ?
 
Old 12-11-2008, 03:41 AM   #2
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 39
Not many users means how many? For example, I have an internal web server with over 5000 users(qps:129) and it doesn't show anything like connection error.

What is your HW configuration, mysql version, PHP, what settings you changed in mysql?

"can not connect to mysql" is it an error auto generated by mysql or your coding output.
 
Old 12-12-2008, 03:05 AM   #3
Murattash
LQ Newbie
 
Registered: Dec 2008
Posts: 2

Original Poster
Rep: Reputation: 0
--- PHP.INI----------------

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =/var/lib/mysql/mysql.sock
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 120
mysql.trace_mode = On
[MySQLi]
mysqli.max_links = -1
mysqli.default_port =
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
-------------------------------------------



--------my.cnf-----------------------------

[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
old_passwords=1
key_buffer = 512M
max_allowed_packet = 10M
max_connect_errors=99999
table_cache = 1200
sort_buffer_size=16M
net_buffer_length=256
read_buffer_size = 16M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 256M
skip-name-resolve
query_cache_size = 64M
query_cache_limit = 16M
query_cache_type = 1
max_user_connections=999
max_connections=750
wait_timeout=240
connect_timeout=180
skip-networking

server-id = 1

skip-host-cache

[safe_mysqld]
log-error=/var/lib/mysql/mysqld.log

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 4M
write_buffer = 4M

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 4M
write_buffer = 4M

[mysqlhotcopy]
interactive-timeout

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log = /var/log/mysqld_multi.log
-----------------------------------------------------------------

my php.code
$username = "root";
$pw = "*******";
$dbname = "******";

$db = mysql_connect("localhost", $username, $pw) or die(mysql_error());
mysql_select_db($dbname,$db) or die(mysql_error());

$queryInsert1 = "INSERT INTO headers VALUES (..... )";

mysql_query($queryInsert1) or die ('Error connecting to mysql');

$queryInsert2 = "INSERT INTO topics VALUES(.....)";
mysql_query($queryInsert2) or die ('Error connecting to mysql');

-------------------------------------------------------------------------------------
Hi tanveer,

Above is my php.ini and my.cnf settings. Yesterday I noticed that in php.ini "socket= " entry was null so I just changed it to "socket= /var/lib/mysql/mysql.sock". As I mentioned before I don't get this error but some users of my website does. At the moment I have around 50 visitors to my website per day. After this recent change I e-mailed to one user who got this error to try it again but I haven't got any reply yet.

My server is using Open Suse 11.0 and it has 1.5 GB Ram and two p4 3.0 ghz processors. I have configured everything through YAST. I am on php 5 and mysql 5 but not sure what is exact version numbers.

The error they get is I think the one in the code "Error connecting to mysql" not a system error.. So the problem I guess should somewhere within this code...



Hope you can have a better understanding of my configuration now..


Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript - submit an iframe form AM1SHFURN1TURE Programming 1 09-23-2006 05:51 PM
submit a form with javascript djgerbavore Programming 6 06-01-2005 02:46 PM
is this php automatic form submit post wriiten correctly? fsock error.. verbatim Programming 1 05-11-2005 10:24 AM
Authentication by Submit Form in Apache??????? ruiseixas Linux - Security 1 11-22-2003 11:02 PM
shell script form submit precioso77 Linux - General 2 05-18-2003 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration