locked
PHP pdo azure problem RRS feed

  • Question

  • hello !

    i got an application that i'm wrote.

    the application works great localy on iis 7 .. and when i am uploading that to azure.. something bad happend..!

    i tested few script and found out that the problem is pdo extends..

    what is wrong with the extend in azure server??? (working good on local pc....) 

    <?php 
    
    
     class Database extends PDO { 
    
           private static $instance;
    
           public static function  getInstance() {        if(self::$instance === null) {            self::$instance = new Database();        }        return self::$instance;    }
    
    /////////////////////////////
    
     private function __clone() { }
    
    /////////////////////////////
    
     public function  __destruct(){$instance = null;}
    
    /////////////////////////////
        public function __construct(){ 
            
            parent::__construct("string!!");     
             
        } //end of public function __construct
         
      
    
    /////////////////////////////
    /////////////////////////////
    
    
    }
    
    ?>

    and in the php.ini file:

    [PHP_PDO_SQLSRV_53_TS]
    extension=php_pdo_sqlsrv_53_ts.dll
    [PHP_SQLSRV_53_TS]
    extension=php_sqlsrv_53_ts.dll

    what's wrong ?

    thanks!

    edit: every page that using db class will return 500 Internal Server Error

    • Edited by yaron12345 Wednesday, July 11, 2012 9:28 PM
    Wednesday, July 11, 2012 9:24 PM

Answers

  • Two things could be wrong:

    1. Maybe PDO is throwing an exception because you're effectively calling: new PDO('string!!');  I assume you have replaced your real connection string with 'string!!'.
    2. Windows Azure should use this driver for PDO: php_pdo_sqlsrv_53_nts.dll

    Rob

    • Proposed as answer by Iric Wen Friday, July 13, 2012 6:53 AM
    • Marked as answer by Iric Wen Thursday, July 19, 2012 8:27 AM
    Thursday, July 12, 2012 9:48 AM