MySQL not fully supported?

From: Date: Thu, 23 Mar 2000 01:05:49 +0000
Subject: MySQL not fully supported?
Groups: php.version4 
Request: Send a blank email to php-version4+get-12509@lists.php.net to get a copy of this message
Here is two equivalent scripts that run perfectly under PHP3 on our server. Script 1 is not working under PHP4. Unfortunately, it seems that parts of PHPLIB rely on features of script 1. Script 1 -------- <? mysql_connect("localhost","root","xxxxxx"); $sql_query_string="select annonces.id,annonces.code,marques.nom,annonces.modele,annonces.annee,annonces.km,annonces.prix,annonces.photo from annonces,marques where annonces.marque_id=marques.id order by marques.nom ASC, annonces.modele"; $result=mysql("citroen",$sql_query_string); $num=mysql_num_rows($result); if ($num==0) { echo( "No vehicule found.<BR>" ); } else { for ($i=0; $i < $num; $i++) { $id= mysql_result($result,$i,"annonces.id"); $code= mysql_result($result,$i,"annonces.code"); $marque= mysql_result($result,$i,"marques.nom"); $modele= StripSlashes(mysql_result($result,$i,"annonces.modele")); $annee= mysql_result($result,$i,"annonces.annee"); $km= mysql_result($result,$i,"annonces.km"); $prix= mysql_result($result,$i,"annonces.prix"); $photo= intval(mysql_result($result,$i,"annonces.photo")); echo( "$id, $code, $marque, $modele, $annee, $km, $prix<BR>\n" ); } } ?> Script 2 -------- <? mysql_connect("localhost","root","xxxxxx"); mysql_select_db( "citroen" ); $sql_query_string="select annonces.id,annonces.code,marques.nom,annonces.modele,annonces.annee,annonces.km,annonces.prix,annonces.photo from annonces,marques where annonces.marque_id=marques.id order by marques.nom ASC, annonces.modele"; $result=mysql_query($sql_query_string); while( $row = mysql_fetch_row( $result ) ) { list( $id, $code, $marque, $modele, $annee, $km, $prix, $photo ) = $row; echo( "$id, $code, $marque, $modele, $annee, $km, $prix<BR>\n" ); } ?> Normal output of both scripts ----------------------------- 1, MG199808, Citroën, CX Prestige, 1983, 250000, 15000 2, VIN2808981, Citroën, Xsara, 97, 45000, 65000 Output of script 1 with PHP4 ---------------------------- , , , , , , , , , , , , Script 2 is working fine under both PHP3 and PHP4. Script 1 is only working fine under PHP3. Apache error log ---------------- We have found the following error log in Apache log (the Apache server running PHP4): [Wed Mar 22 12:46:04 2000] Script: '/home/httpd/html/wml/test/scrip1.phtml' --------------------------------------- php_mysql.c(197) : Block 0x08146900 status: Beginning: OK (allocated on php_mysql.c:525, 432 bytes) End: Overflown (magic=0x00000000 instead of 0x2A8FCC84) At least 4 bytes overflown --------------------------------------- php_mysql.c(525) : Freeing 0x08146924 (432 bytes), script=/home/httpd/html/wml/script1.phtml [Wed Mar 22 12:46:04 2000] [notice] child pid 16435 exit signal Segmentation fault (11) Our configuration ----------------- We are running Linux 2.2.x, Apache 1.3.x, PHP4.0b5dev (we got too many crashes. not MySQL related, with the official 4.0b4, so we went to see if the CVS version was solving our problems) and MySQL 3.22.10. Note that PHP4 seems to be bundled with MySQL 3.23.10-alpha support, at least this is what the phpinfo page claims. Extract of our phpinfo() for PHP4 --------------------------------- System: Linux horus 2.2.14 #1 SMP Thu Jan 6 06:21:55 EST 2000 i686 unknown Build Date: Mar 22 2000 Configure command: './configure' '--disable-safe-mode' '--enable-memory-limit' '--enable-track-vars' '--enable-force-cgi-redirect' '--enable-discard-path' '--with-config-file-path=/usr/local/etc' '--with-mysql' '--with-gd' '--with-apxs=/usr/local/apache.1.3.12-2.6.2-4beta_cvs/bin/apxs' '--enable-thread-safety' '--with-gettext' '--with-xml' php.ini path: /usr/local/etc ZEND_DEBUG=1 SAPI=Apache ZTS is undefined mysql.allow_persistent On On mysql.max_persistent Unlimited Unlimited mysql.max_links Unlimited Unlimited mysql.default_host no value no value mysql.default_user no value no value mysql.default_password no value no value mysql.default_port no value no value Active Persistent Links 0 Active Links 0 Client API version 3.23.10-alpha MYSQL_INCLUDE MYSQL_LFLAGS MYSQL_LIBS Questions --------- * Has anyone an idea about the above problem? * How to force PHP4 to compile with the MySQL files installed on our server (rather than its own)? * Are any of the PHP MySQL functions used in script 1 obsolete in PHP4? * What kind of information should we provide you with to help you find the problem? This is the only problem we have (so far) with PHP4b5dev, all other problems encountered in PHP4b4 seem to have been fixed. Cordially, Mikael -- Mikael Grave Tel. (613) 731-4046 http://www.webmotion.com Webmotion Inc. Fax. (613) 260-9545 mikael.grave@webmotion.com `----------------------------------------------------------------'

« previous php.version4 (#12509) next »