I am playing with Yii framework and now I am investigating Yii Shell. But if I use this command:
yiic shell
I always get this error message:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/oci8.so’ - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/pdo_oci.so’ - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0 libdc1394 error: Failed to initialize libdc1394 PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/oci8.so’ - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/pdo_oci.so’ - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0 Error: index.php does not exist or is not an entry script file.
It is strange for me, because I am gonna to use only mySQL drivers, so why Oracle now? Any idea?
why are you blaming Yii? It has nothing to do with Yii, but with your PHP environment setup. Really:-)
The problem is, that when you execute command line, it loads different php.ini.
Each PHP installation works this way.
For HTTP requests PHP uses one configuration (examine via phpinfo) and via CLI another.
This is confusing for many users, but it must be this way since CLI creates a bit different environment, for example it cannot set environmental variables related to HTTP request since this is NOT http request. For example in CLI mode you cannot use $_SERVER[‘SERVER_NAME’] variable because it cannot be set by nature.
To solve your issue, you have two options:
either figure out which php.ini is loaded in CLI mode (by echoing phpinfo) and then set it exactly like php.ini loaded for HTTP requests. At least comment out extension for oracle:-)
or
remap CLI command to load php.ini used also for http requests. This can be done via modifying yiic.bat file inside your /protected/ directory. E.g. I use this mapping to desired PHP version installed on Wamp server:
@echo off
rem -------------------------------------------------------------
rem Yii command line script for Windows.
rem This is the bootstrap script for running yiic on Windows.
rem -------------------------------------------------------------
@setlocal
set BIN_PATH=%~dp0
rem if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
if "%PHP_COMMAND%" == "" set PHP_COMMAND=c:\wamp\bin\php\php5.2.11\php.exe
"%PHP_COMMAND%" "%BIN_PATH%yiic.php" %*
@endlocal
thank you for your helpful reply. It is true and new for me that CLI use another PHP configuration. I have found a lot of .ini files in /etc/php.d folder and there also oci8.ini and pdo_oci.ini, so I can disable it now.