ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾PHP ±à³Ì£¾PHP5ÖÐÎÄÊÖ²á
PHP5ÖÐÎÄÊÖ²á

Êý¾Ý¿âÎÊÌâ

±¾½Ú°üÀ¨ PHP ºÍÊý¾Ý¿âÖ®¼ä¹ØϵµÄ³£¼ûÎÊÌâ¡£Êǵģ¬PHP ÊÂʵÉÏ¿ÉÒÔ·ÃÎÊÈç½ñÏÖÓеÄÈκÎÊý¾Ý¿â¡£

  1. a¬e¡¥¡¯ PHP aœ‰a¡¥eƒ½eR¿e—R Microsoft SQL Serveri¼Œa€Ža ¡¤eR¿e—Ri¼Ÿ
  2. eƒ½eR¿e—R Microsoft Access a•¡ãaRao“a—i¼Ÿ
  3. aˆ‘a‡co¡ìaˆ¡ãao† PHP 4i¼Œc»“ažœ MySQL a£¬a–-aŠ£¤a‘Ša€œWarning: MySQL: Unable to save result set in ..a€i¼Œe¿™a˜¡¥a€Ža1ˆa›žao‹i¼Ÿ
  4. PHP 5 a£¬a†c»‘aRš MySQL aR¡éaˆ¡¤c«¡¥ao“i¼Œe¿™a¡¥1aˆ‘a„a‘3c€a»€a1ˆi¼Ÿaˆ‘e¿˜eƒ½aœ¡§ PHP a£¬-a½¿c”¡§ MySQL a—i¼Ÿaˆ‘e¡¥•c€a½¿c”¡§ MySQL c»“ažœa¾—aˆ¡ãa€œfunction undefineda€e”™e¡¥¡¥i¼Œa€Ža1ˆaŠži¼Ÿ
  5. aœ¡§aR‰e¡ê…a…¡Àao« MySQL a”¡¥aŒa1‹aŽi¼Œaae|a£¬€aŠ e½½ libphp4.soi¼ŒApachea¡ã¡Àa¼š core dumpa€‚e¿™a£¬ae—Re¡é˜eƒ½e¡ì¡êa†3a—i¼Ÿ
  6. a£¬oa»€a1ˆaˆ‘a¾—aˆ¡ãc¡À»a¼¼a|‚a£¬‹cš„e”™e¡¥¡¥i¼ša€œWarning: 0 is not a MySQL result index in <file> on line <x>a€aˆ–e€…a€œWarning: Supplied argument is not a valid MySQL result resource in <file> on line <x>a€i¼Ÿ
  7. Ìý˵ PHP ÓпÉÄÜ·ÃÎÊ Microsoft SQL Server£¬ÔõÑù·ÃÎÊ£¿

    ÔÚ Windows »úÆ÷ÖУ¬¿ÉÒÔ¼òµ¥µØʹÓÃÄÚÖÃµÄ ODBC Ö§³ÖºÍÕýÈ·µÄ ODBC Çý¶¯³ÌÐò¡£

    ÔÚ Unix »úÆ÷ÖУ¬¿ÉÒÔÓà Sybase-CT Çý¶¯³ÌÐòÀ´·ÃÎÊ Microsoft SQL Server£¬ÒòΪËüÃǵÄЭÒéÊÇ£¨ÖÁÉٴ󲿷֣©¼æÈݵġ£Sybase ×öÁËÒ»¸ö » Linux ϵͳÏÂËùÐè¿âµÄÃâ·Ñ°æ±¾¡£¶ÔÓÚÆäËü Unix ²Ù×÷ϵͳ£¬ÐèÒªºÍ Sybase ÁªÏµÀ´µÃµ½ÕýÈ·µÄ¿â¡£Í¬ÑùÒ²¿´¿´ÏÂÒ»¸öÎÊÌâµÄ»Ø´ð¡£

    ÄÜ·ÃÎÊ Microsoft Access Êý¾Ý¿âÂð£¿

    ¿ÉÒÔ¡£Èç¹ûÍêÈ«ÔÚ Windows 9x/Me/NT/2000 ÏÂÔËÐУ¬ÄÇÒѾ­ÓÐÁËËùÓÐËùÐèµÄ¹¤¾ß£¬¿ÉÒÔÓà ODBC ºÍ Microsoft's ODBC drivers for Microsoft Access database¡£

    Èç¹ûÔÚ Unix ÏÂÔËÐÐ PHP ¶øÏë·ÃÎÊ Windows ÖÐµÄ MS Access£¬ÄÇÐèÒª Unix ODBC Çý¶¯³ÌÐò¡£» OpenLink Software ÓÐÒ»¸ö»ùÓÚ Unix µÄ ODBC Çý¶¯³ÌÐò¿ÉÒÔ×öÕâ¼þÊ¡£

    ÁíÍâÒ»¸öÌæ´ú·½°¸ÊÇÓôø Windows ODBC Çý¶¯µÄ SQL Server ²¢ÓÃËüÀ´´¢´æÊý¾Ý£¬¿ÉÒÔͨ¹ý Microsoft Access£¨Óà ODBC£©ºÍ PHP£¨ÓÃÄÚÖÃÇý¶¯£©À´·ÃÎÊ£¬»òÕßÓÃÒ»¸ö Access ºÍ PHP ¶¼Ê¶±ðµÄÖмäÎļþ¸ñʽ£¬ÀýÈç flat Îļþ»òÕß dBase Êý¾Ý¿â¡£¹ØÓÚÕâÒ»µã OpenLink Software µÄ Tim Hayes дµÀ£º

    µ±¿ÉÒÔͨ¹ý ODBC Ö±½Ó´Ó PHP ·ÃÎÊÊý¾Ý¿âʱ©¤©¤ÀýÈçÓà OpenLink µÄÇý¶¯³ÌÐò£¬Ê¹ÓÃÆäËüÊý¾Ý¿â×öÖмäý½é²»ÊÇÒ»¸öºÃÖ÷Òâ¡£Èç¹ûȷʵÐèÒªÒ»¸öÖмäÎļþ¸ñʽ£¬OpenLink ÒѾ­·¢²¼Á˶ÔÓ¦ÓÚ Windows NT£¬Linux ºÍÆäËü Unix ƽ̨µÄ Virtuoso£¨Ò»¸öÐéÄâÊý¾Ý¿âÒýÇ棩¡£Çë·ÃÎÊÎÒÃǵĻ ÍøÕ¾À´Ãâ·ÑÏÂÔØ¡£

    »¹ÓÐÒ»¸öÒѱ»Ö¤ÊµÓÐЧµÄÑ¡ÔñÊÇÔÚ Windows ÏÂÓà MySQL ºÍËüµÄ MyODBC Çý¶¯À´Í¬²½Êý¾Ý¿â¡£Steve Lawrence дµÀ£º

    • ¸ù¾Ý MySQL µÄ˵Ã÷ÔÚÄãµÄƽ̨ÉÏ°²×° MySQL¡£¿ÉÒÔ´Ó » http://www.mysql.com/ µÃµ½×îа档³ýÁËÉ趨Êý¾Ý¿âºÍÅäÖÃÓû§ÕʺÅÒÔÍâ²»ÐèÒªÌØÊâµÄÅäÖã¬Ó¦¸ÃÔÚ host ×Ö¶ÎÖзÅÒ»¸ö % »òÕßÒªÓÃÀ´·ÃÎÊ MySQL µÄ Windows »úÆ÷Ãû¡£¼ÇÏÂ×Ô¼ºµÄ·þÎñÆ÷Ãû£¬Óû§ÃûºÍÃÜÂë¡£
    • ´Ó MySQL ÍøÕ¾ÏÂÔØ MyODBC for Windows Çý¶¯³ÌÐò¡£ÔÚÄãµÄ Windows »úÆ÷Öа²×°Ëü¡£¿ÉÒÔÓô˳ÌÐòÖаüÀ¨µÄ¹¤¾ßÀ´²âÊÔÆä²Ù×÷¡£
    • ÓÿØÖÆÃæ°åÖÐµÄ ODBC ¹ÜÀíÆ÷н¨Ò»¸öÓû§»òϵͳ dsn£¬É趨 dsn Ãû³Æ£¬ÊäÈëÄãÔÚµÚÒ»²½ÖÐÅäÖÃµÄ MySQL Êý¾Ý¿âµÄÖ÷»úÃû£¬Óû§Ãû£¬ÃÜÂ룬¶Ë¿ÚµÈ¡£
    • ÍêÕû°²×° Access£¬ÕâÑù¿ÉÒÔÈ·±£µÃµ½Êʵ±µÄ²å¼þ ... ÖÁÉÙÐèÒª ODBC Ö§³ÖºÍÁ¬½Ó±í¹ÜÀíÆ÷¡£
    • н¨Ò»¸ö Access Êý¾Ý¿â¡£ÔÚ Table ´°¿Úµã»÷ÓÒ¼ü²¢Ñ¡Ôñ Link Tables£¬»òÕßÔÚ File ²Ëµ¥ÏÂÑ¡Ôñ Get External Data -> Link Tables¡£µ±Îļþä¯ÀÀ´°¿Ú´ò¿ªºó£¬Ñ¡ÔñÎļþÀàÐÍΪ£ºODBC¡£½Ó×ÅÑ¡Ôñ System dsn ÒÔ¼°ÔÚµÚÈý²½½¨Á¢µÄ dsn µÄÃû×Ö¡£ÔÙÑ¡ÔñÒªÁ¬½ÓµÄ±í£¬µã»÷ OK¡£ÏÖÔÚÄã¿ÉÒÔÔÚÄãµÄ MySQL ·þÎñÆ÷Öдò¿ª±í²¢Ð½¨£¯É¾³ý£¯±à¼­Êý¾ÝÁË£¡Ò²¿ÉÒÔ¹¹Ôì²éѯ£¬µ¼È룯µ¼³ö±íµ½ MySQL£¬¹¹Ôì±íµ¥ºÍ±¨¸æµÈ¡£

    ÌáʾÓë¼¼ÇÉ£º

    • ¿ÉÒÔÔÚ Access Öй¹Ôì±í²¢µ¼³öµ½ MySQL ÖУ¬ÔÙ°ÑËüÃÇÁ¬½Ó»ØÀ´¡£ÕâÑù¿ÉÒÔʹ±íµÄ½¨Á¢¸ü¿ì¡£
    • ÔÚ Access Öн¨Á¢±íʱ£¬±ØÐ趨ÒåÒ»¸ö»ù±¾¼üÃûÀ´È¡µÃ±íµÄдȨÏÞ¡£È·ÈÏÔڰѱíÁ¬½Óµ½ Access ֮ǰÔÚ MySQL Öн¨Á¢ÁË»ù±¾¼üÃû¡£
    • Èç¹ûÔÚ MySQL ÖÐÐÞ¸ÄÁË±í£¬±ØÐëÖØÐÂÁ¬½Óµ½ Access¡£´ò¿ª Tools>Add-ins>Linked table manager£¬ÕÒµ½ÄãµÄ ODBC DSN£¬È»ºóÔÚÕâÀïÑ¡ÔñÒªÖØÐÂÁ¬½ÓµÄ±í¡£Ò²¿ÉÒÔÔÚÕâÀïÒƶ¯ dsn Ô´£¬ÔÚµã»÷ OK ֮ǰѡÖÐ always prompt for new location¡£

    ÎÒÉý¼¶µ½ÁË PHP 4£¬½á¹û MySQL ²»¶Ï±¨¸æ¡°Warning: MySQL: Unable to save result set in ..¡±£¬ÕâÊÇÔõô»ØÊ£¿

    ¿´ÉÏÈ¥×îÓпÉÄܵÄÊÇ£¬PHP 4 ÔÚ±àÒëʱʹÓÃÁË --with-mysql Ñ¡ÏûÓÐÖ¸¶¨ MySQL µÄ·¾¶¡£ÕâÒâζ×Å PHP ʹÓÃÁËËü×Ô¼ºÄÚÖÃµÄ MySQL ¿Í»§¶Ë¿â¡£Èç¹ûÄãµÄϵͳÔËÐÐÁËʹÓÃÆäËü°æ±¾µÄ MySQL ¿Í»§¶Ë¿âµÄÓ¦ÓóÌÐò£¬ÀýÈç×÷Ϊ Apache Ä£¿éµÄ PHP 3£¬ÄÇôÔÚÁ½¸ö²»Í¬°æ±¾µÄ¿Í»§¶ËÖ®¼äÓгåÍ»¡£

    ÖØбàÒë PHP 4£¬²¢ÔÚ±ê¼ÇÖмÓÉÏ MySQL µÄ·¾¶¡°--with-mysql=/your/path/to/mysql¡±Í¨³£»á½â¾ö´ËÎÊÌâ¡£

    PHP 5 ²»ÔÙ°ó¶¨ MySQL ¿Í»§¶Ë¿â£¬Õâ¶ÔÎÒÒâζ×Åʲô£¿ÎÒ»¹ÄÜÔÚ PHP ÖÐʹÓà MySQL Âð£¿ÎÒÊÔ×ÅʹÓà MySQL ½á¹ûµÃµ½¡°function undefined¡±´íÎó£¬Ôõô°ì£¿

    Êǵġ£PHP ×ÜÊÇÖ§³Ö MySQL µÄ£¬²»ÊÇÕâÖÖ·½·¨¾ÍÊÇÄÇÖÖ·½·¨¡£ÔÚ PHP 5 ÖÐΨһµÄ¸Ä±ä¾ÍÊDz»Ôٰ󶨿ͻ§¶Ë¿â±¾ÉíÁË¡£²¿·ÖÔ­ÒòÊÇ£¨ÎÞÌض¨Ë³Ðò£©£º

    • ÏÖ½ñ´ó¶àÊýϵͳÒѾ­°²×°ÁË¿Í»§¶Ë¿âÁË¡£

    • ÓÉÓÚÒÔÉÏÔ­Òò£¬±£³Ö¶à¸ö°æ±¾µÄ¿âÎļþ»áµ¼Ö»ìÂÒ¡£ÀýÈ磬Èç¹û°Ñ mod_auth_mysql Á¬½Óµ½Ä³¸ö°æ±¾£¬µ«°Ñ PHP Á¬½Óµ½ÁËÁíÒ»¸ö°æ±¾£¬È»ºóÔÚ Apache ÖÐͬʱ¼¤»îÁËËüÃÇ£¬»áµÃµ½ÎÞÊý´íÎó¡£´ËÍ⣬°ó¶¨µÄ¿âÎļþÒ²²»×ÜÊÇÄܺͷþÎñÆ÷¶ËµÄ°æ±¾ºÜºÃµØÅäºÏ¡£¶Ô´Ë×îÃ÷ÏÔµÄÖ¢×´ÊÇÉÏÄÄÀïÈ¥ÕÒ UNIX ÓòÌ×½Ó×ÖÎļþ mysql.socket¡£

    • ά»¤ÓÐЩËÉи£¬²¢ÇÒÒѾ­Ô½À´Ô½ÂäºóÓÚ·¢Ðеİ汾ÁË¡£

    • δÀ´µÄ¿â°æ±¾ÊÇ»ùÓÚ GPL µÄ£¬Òò´ËÎÒÃÇûÓÐÉý¼¶µÄ;¾¶ÁË£¬ÒòΪÎÒÃDz»Äܽ«»ùÓÚ GPL µÄ¿âºÍ BSD/Apache ·ç¸ñÐí¿ÉÖ¤µÄÏîÄ¿°ó¶¨µ½Ò»Æð¡£Òò´Ë¾ßÓÐÒ»¸ö¸É¾»µÄ PHP 5 ÊÇ×îºÃµÄÑ¡Ôñ¡£

    ÊÂʵÉÏÕâ²¢²»»áÓ°Ï쵽̫¶àÈË¡£UNIX Óû§£¬ÆðÂëÊÇÄÇЩ֪µÀ×Ô¼ºÔÚ×öʲôµÄÈË£¬ÍùÍù»áÔÚ±àÒë PHP ʱͨ¹ý --with-mysql=/usr ½«Æä°ó¶¨µ½×Ô¼ºÏµÍ³ÖÐµÄ libmyqlclient ¿âÉÏ¡£Windows Óû§¿ÉÒÔÔÚ php.ini Ö줻î php_mysql.dll À©Õ¹¿â¡£¸ü¶àϸ½Ú¼û MySQL º¯ÊýÖеݲװָÄÏ¡£´ËÍ⣬ȷÈÏ libmysql.dll ÔÚϵͳ·¾¶ÖС£¾ßÌåÔõÑù×öµÄÏêÇ飬ÇëÔĶÁ FAQ ÖеÄÉ趨 Windows ϵͳ·¾¶¡£ÒòΪ libmysql.dll£¨ÒÔ¼°ºÜ¶àÆäËü PHP ÓйØÎļþ£©´æ·ÅÓÚ PHP Ŀ¼ÖУ¬¿ÉÄÜÐèÒª½« PHP Ŀ¼¼ÓÈ뵽ϵͳ·¾¶ÖС£

    ÔÚ°²×°¹²Ïí MySQL Ö§³ÖÖ®ºó£¬Ö»ÒªÒ»¼ÓÔØ libphp4.so£¬Apache¾Í»á core dump¡£Õâ¸öÎÊÌâÄܽâ¾öÂð£¿

    Èç¹ûÄãµÄ MySQL ¿âÒÀ¿¿ pthreads Á¬½Ó¾Í»áÕâÑù¡£¼ì²éÊÇ·ñʹÓÃÁË ldd¡£Èç¹ûÓеĻ°£¬ÏÂÔØ MySQL Ô´³ÌÐò±àÒ룬»òÕß´ÓÔ´ rpm µÄ spec ÎļþÖÐÈ¥µô´ò¿ª threaded client µÄÑ¡ÏîÈ»ºóÖØбàÒë¡£ÒÔÉÏÈÎÒ»½¨Òé»á½â¾ö´ËÎÊÌ⡣ȻºóÔÙ¼ÓÉÏÐ嵀 MySQL ¿âÖØбàÒë PHP¡£

    ΪʲôÎҵõ½ÀàËÆÈçϵĴíÎ󣺡°Warning: 0 is not a MySQL result index in <file> on line <x>¡±»òÕß¡°Warning: Supplied argument is not a valid MySQL result resource in <file> on line <x>¡±£¿

    ÄãÊÔͼÓÃÒ»¸öֵΪ 0 µÄ½á¹û×ÊÔ´ºÅ¡£0 ±íʾÄãµÄ²éѯÓÉÓÚijԭÒòʧ°ÜÁË£¬ÐèÒªÔÚÌá½»²éѯ֮ºóºÍÔÚʹÓ÷µ»Ø½á¹û×ÊÔ´ºÅ֮ǰ¼ì²é´íÎó¡£ÕýÈ·µÄ·½·¨ÊÇÓÃÀàËÆÈçϵĴúÂ룺

    <?php

    $result 
    mysql_query("SELECT * FROM tables_priv");
    if (!
    $result) {
        echo 
    mysql_error();
        exit;
    }
    ?>
    »òÕß
    <?php

    $result 
    mysql_query("SELECT * FROM tables_priv")
        or die(
    "Bad query: " mysql_error());
    ?>