RE: [PHP-INST] MySQL connection problem

From: Date: Tue, 20 Feb 2001 00:29:38 +0000
Subject: RE: [PHP-INST] MySQL connection problem
Groups: php.install 
Request: Send a blank email to php-install+get-2139@lists.php.net to get a copy of this message
On the main page: <?php include ("samp_db.inc"); samp_db_connect () or exit (); $result = mysql_query ("SELECT COUNT(*) FROM member") or exit (); if ($row = mysql_fetch_array($result)) echo "<P>The League currently has " . $row[0] . " members"; mysql_free_result ($result); ?> The samp_db.inc is in /usr/local/apache/php. From /usr/local/apache/php/samp_db.inc: <?php # samp_db.inc # samp_db sample database common functions # Connect to the MySQL server using name function samp_db_connect () { $link = mysql_pconnect ('server.xyz.com', 'root'); if ($link && mysql_select_db ("samp_db")) return ($link); return (FALSE); } ?> From /usr/local/lib/php.ini: include_path = "/usr/local/apache/php" -----Original Message----- From: mailing-lists [mailto:mailing-lists@reflectionmedia.com] Sent: Monday, February 19, 2001 4:06 PM To: Larry Marshall Subject: RE: [PHP-INST] MySQL connection problem What code are u using in your webpage, and did you install. Send that over, the connection script that you are using. Matt -----Original Message----- From: Larry Marshall [mailto:LarryM@marshap.com] Sent: Monday, February 19, 2001 6:01 PM To: 'php-install@lists.php.net' Subject: [PHP-INST] MySQL connection problem Using RedHat7, apache_1.3.17, php-4.0.4pl1 and MySQL 3.23.32. I installed MySQL from an RPM. I installed PHP and apache from source, statically. I can access MySQL from an linux prompt: mysqladmin -ulcm lists: Server version 3.23.32 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 4 days 23 hours 46 min 45 sec Threads: 1 Questions: 69 Slow queries: 0 Opens: 18 Flush tables: 1 Open tables: 12 Queries per second avg: 0.000 However, mysqladmin -h hostname gives the -? help. When I create the following in a php script: $link = mysql_pconnect ('server.xyz.com', 'root'); The web page puts the following out: Warning: Unknown MySQL Server Host 'server.xyz.com' (11) in /usr/local/apache/php/samp_db.inc on line 8 What am I missing here? -- PHP Install Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net For additional commands, e-mail: php-install-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.install (#2139) next »