Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP MySQL function problems

Status
Not open for further replies.

cmarchman

Programmer
Jun 18, 2004
56
US
Here's what was posted on the MySQL forum and discovered that it was a PHP problem. Below is the posting:


cmarchman (Programmer)
15 Apr 05 13:12
Hi. I have a problem with a Fedora Core 3 server build running Apache 2.0.52-3, PHP 4.3.9-3, MySQL-server 3.23.58-13. It also has the php-mysql-4.3.9-3 installed.

The problem - bringing up Mozilla browser on localhost (for testiing purposes) the index.php page displayes fine, except the mysql_query results do not show up. Nothing within the PHP tags show up, not even errors.

I've substituted the phpinfo (); within the php tags and it displayed the php info page with no problems. So, I can only think that it has to do with mysql or Mozilla.

Here is a sample code:


<?php

$command = "/usr/bin/mysql -u root -pfr33bas3 < mydbtest.txt | sed /Database/d | sed /mysql/d | sed /test/d | sed /snort/d | sed /snortcenter/d";
$dblist = exec($command, $db);

foreach($db as $list) {

print "The following link is for the Results contained in Database <a href=ipsh.php?database=$list>$list</a> scanned on:<br>";
mysql_connect("xxx.xxx.xxx.xxx", "root", "xxxxxxxx");
$timedate = mysql_query(
"select timestamp from $list.timestamps where id = 1");

while ($row = mysql_fetch_assoc($timedate)) {

$date = $row["timestamp"];
print "<b>$date</b>";

}
print "<br><br><br><br>";
}
?>


I have had this working on other systems, mainly RH builds, so I know it works.

Also, this is being run from a VMWare image, but I'm not sure if that would make a difference.

Thanks in advance,

cmarchman
Find A Job or Post a Job Opening Click Here.
azzazzello (TechnicalUser)
15 Apr 05 13:21
run that script using php from command line and see what happens. at the prompt do

php abovescript.php
cmarchman (Programmer)
15 Apr 05 14:25
azzazzello,

Whoa! What a mess. I see now that it is a PHP issue.
Look at what I got back:

PHP Notice: Constant MYSQL_ASSOC already defined in Unknown on line 0
PHP Notice: Constant MYSQL_NUM already defined in Unknown on line 0
PHP Notice: Constant MYSQL_BOTH already defined in Unknown on line 0
PHP Notice: Constant MYSQL_CLIENT_COMPRESS already defined in Unknown on line 0PHP Notice: Constant MYSQL_CLIENT_INTERACTIVE already defined in Unknown on line 0
PHP Notice: Constant MYSQL_CLIENT_IGNORE_SPACE already defined in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_connect in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_pconnect in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_close in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_select_db in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_create_db in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_drop_db in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_query in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_unbuffered_query in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_db_query in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_list_dbs in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_list_tables in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_list_fields in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_list_processes in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_error in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_errno in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_affected_rows in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_insert_id in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_result in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_num_rows in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_num_fields in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fetch_row in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fetch_array in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fetch_assoc in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fetch_object in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_data_seek in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fetch_lengths in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fetch_field in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_field_seek in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_free_result in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_field_name in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_field_table in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_field_len in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_field_type in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_field_flags in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_escape_string in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_real_escape_string in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_stat in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_thread_id in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_client_encoding in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_ping in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_get_client_info in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_get_host_info in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_get_proto_info in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_get_server_info in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_info in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fieldname in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fieldtable in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fieldlen in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fieldtype in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_fieldflags in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_selectdb in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_createdb in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_dropdb in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_freeresult in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_numfields in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_numrows in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_listdbs in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_listtables in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_listfields in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_db_name in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_dbname in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_tablename in Unknown on line 0
PHP Warning: Function registration failed - duplicate name - mysql_table_name in Unknown on line 0
PHP Warning: mysql: Unable to register functions, unable to load in Unknown on line 0
Content-type: text/html
X-Powered-By: PHP/4.3.9


Do you know what's going on, or should I post this on the PHP forum?

Thanks for that great troubleshooting tip!!!

cmarchman
azzazzello (TechnicalUser)
15 Apr 05 15:19
I would suspect that there is something wierd going on with php-mysql module...but that is my stab in the dark. Post it on the PHP forum - I am sure someone will be able to tell you what's wrong in a jiffy. Some smart cookies here :)

Any help would be greatly appreciated.

cmarchman
 
Seems like some modules are loaded over a already compiled version that has the module included.
Check out the phpinfo() output for what's included in the "Configure command" section of the output.
If it shows something like --with-mysql=/usr/local/etc... then it's already compiled in and any .so module should not have to be loaded.
 
DRJ478,

Okay, I've located the '--with-mysql=shared,/usr'. Now how do I go about taking out the .so modules from the system?

You've been a big help, thanks.

cmarchman
 
DRJ478,

I've got the PHP Warnings all gone. Now it's barking with the mysql_connect with following error:

PHP Fatal error: Call to undefined function: mysql_connect() in /var/ on line 29.

Any ideas?

Thanks,

cmarchman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top