简体   繁体   中英

Laravel Composer PHP version changed from 5.6 to 7.0.10 gives error

I installed my laravel/composer using the PHP version 5.6 and everything was working smoothly now I need to use the LDAP so when I checked and it was given that I need PHP 7.0 or higher to use that so I tried changing the PHP version to 7.0.10 and I am getting following error to the previous code which was working find.

QueryException
could not find driver

I tried updating the composer but nothing I working fine, any suggestions.

I am using SQL Server, Laravel Framework 5.4.36, PHP 7.0.10. I need to implement LDAP which is mentioned here so I am making these changes: https://github.com/Adldap2/Adldap2-Laravel

The code works fine when I switch back to PHP 5.6 so it seems like there is nothing wrong with the code, My guess is something to do with PHP. Is there a way to implement LDAP without switching the PHP version.

You need to install the correct driver for php7.0. If you look run

php -m 

while using php7.0, you will see that you do not have a database driver module installed. Switch back to php5.6 and run the same command. Note all the modules that are installed and then switch back to php7.0 and get all the appropriate modules out of the php7.0 repo.

php5.6 modules will not run (or will rarely run correctly) after you upgrade to php7.0.

Thanks a lot everyone for helping, I finally did it. I was able to change the PHP from PHP 5.6 to 7.0.1 so Now my COMPOSER for LARAVEL is using this.

  1. Download and install ODBC drivers here: https://www.microsoft.com/en-US/download/details.aspx?id=36434

  2. Download the DLL here (both 7.0. and 7.1.can be found): https://github.com/Microsoft/msphpsql/releases

Place these DLL Files in your WAMP PHP version folder

C:\wamp\bin\php\php7.0.10\ext

Open your "php.ini" file and look for the "extension=" line. This will tell you where to put the DDL files. You can put entire path for the DLL like

extension=C:\wamp\bin\php\php7.0.10\ext\php_sqlsrv_7_ts.dll
extension=C:\wamp\bin\php\php7.0.10\ext\php_sqlsrv_7_nts.dll

Put the DLL files contains in the Zip archive in your extension directory. Make sure to select the proper select the proper version. Note: I initially tried to use the x64 version, but it didn't work. Then, I replaced the DLL with the x86 version and it finally worked.

Posting this answer so that it will help anyone who is struggling just like me.

Make sure to restart your WAMP server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM