PHP loads extension from CGI but NOT from CLI
So this is a weird one and one I had to workaround instead of fixing.
I've had PHP5.5 working fine but Magento requires 5.6 so I downloaded it along with all the extensions I have been using like pdo_sqlsrv, xcache and memcache.
I then loaded a local PHP web app to confirm it was setup correctly and that worked fine.
I then ran composer from the command line to download Magento and it errors saying PHP Startup: Unable to load dynamic library php_pdo_sqlsrv_56_nts.dll %1 is not a valid Win32 application.
There are all kinds of pitfalls when using PHP on windows and I tried/checked this:
I've had PHP5.5 working fine but Magento requires 5.6 so I downloaded it along with all the extensions I have been using like pdo_sqlsrv, xcache and memcache.
I then loaded a local PHP web app to confirm it was setup correctly and that worked fine.
I then ran composer from the command line to download Magento and it errors saying PHP Startup: Unable to load dynamic library php_pdo_sqlsrv_56_nts.dll %1 is not a valid Win32 application.
There are all kinds of pitfalls when using PHP on windows and I tried/checked this:
- CLI pointing to the correct php.ini? Yes
- PHP build is 32 bit? Yes
- extension is 32 bit? Yes
- Extension path correct? Yes
- Anything useful in event viewer? No, only the same as the CLI prints (no error for web app)
- Everything else pointing to the right place? Yes
The biggest annoyance is that it was definately working OK in the web app whereas it would just error for the CLI (bearing in mind the local web app was not using the sqlsrv driver). It also only seemed to be that one specific extension it was complaining about (and I have had problems in an earlier life with the same thing).
The only thing I could do was to comment out the offending line in php.ini before running composer update and then put it back in when I next need it. Maybe it's something as simple as the web version not failing on warnings and the CLI one doing the opposite?