sql server - Using SQLSRV extension in PHP CLI script -
folks! this first experience big scripts in php cli , i'm facing 'not found' error when using sqlsrv_connect function in script. running script in browser okay, connects fine, queries goes fine could; when in cli, friend, shows fatal error: call undefined function sqlsrv_connect() what be, dark magic or newbie developer? this how use function: $_dbip = '127.0.0.1'; $_dbnome = $nome_bd; $_dbuid = 'sa'; $_dbpwd = 'very_strong_secret_pwd'; $conn = sqlsrv_connect($_dbip, array('database' => $_dbnome, 'uid' => $_dbuid, 'pwd' => $_dbpwd)) or die( print_r( sqlsrv_errors(), true)); thanks in advance! there 2 php.ini files , 1 cli , 1 web browser. you need make sure extension enable on both. you should use pdo if possible, because better extension , supports sql server .