Connect Ms Sql to laravel | Connect laravel to sql server



1. Visit the link: https://docs.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-ver15
2. Then download the: Microsoft Drivers 5.8 for PHP for SQL Server, click the link.
3. Extract in any folder.
4.
extension=php_pdo_sqlsrv_72_ts_x64
extension=php_sqlsrv_72_ts_x64
copy the below two lines and paste it php.ini configuration file.
#laravel #ms_sql_connection

23 Comments

  1. Why i can't connect the laravel?
    SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.

    (SQL: select * from sys.sysobjects where id = object_id(migrations) and xtype in ('U', 'V'))

  2. Getting the below message :

    InvalidArgumentException

    Database connection [sqlserv] not configured.

    at C:UsersarthoLiveProjectvendorlaravelframeworksrcIlluminateDatabaseDatabaseManager.php:161

    157▕ // If the configuration doesn't exist, we'll throw an exception and bail.

    158▕ $connections = $this->app['config']['database.connections'];

    159▕

    160▕ if (is_null($config = Arr::get($connections, $name))) {

    ➜ 161▕ throw new InvalidArgumentException("Database connection [{$name}] not configured.");

    162▕ }

    163▕

    164▕ return (new ConfigurationUrlParser)

    165▕ ->parseConfiguration($config);

    1 C:UsersarthoLiveProjectvendorlaravelframeworksrcIlluminateDatabaseDatabaseManager.php:124

    IlluminateDatabaseDatabaseManager::configuration("sqlserv")

    2 C:UsersarthoLiveProjectvendorlaravelframeworksrcIlluminateDatabaseDatabaseManager.php:95

    IlluminateDatabaseDatabaseManager::makeConnection("sqlserv")

  3. Note :
    i have error when start apache

    and the first error caused by i use wrong version , if you use php 7.4 just copy file php_pdo_sqlsrv_74_ts_x64.dll
    php_sqlsrv_74_ts_x64.dll

    and in php.ini you can copy this
    extension=php_pdo_sqlsrv_74_ts_x64
    extension=php_sqlsrv_74_ts_x64

    if you still got error like me try to add .dll at the end just like this
    extension=php_pdo_sqlsrv_74_ts_x64.dll
    extension=php_sqlsrv_74_ts_x64.dll

    and make sure you use right version for your processor , for me its x64 not x86

    hope that helping
    and thanks for vidio sir , you helping me so much

  4. I have this error when i start apach:

    le point d'entrée de procédure _zval_ptr_dtor est introuvable dans la bibliothèque de liens dynamiques php_pdo_sqlsrv_72_ts_x64
    le point d'entrée de procédure add_index_zvalest introuvable dans la bibliothèque de liens dynamiques php_pdo_sqlsrv_72_ts_x64
    le point d'entrée de procédure _zval_ptr_dtor est introuvable dans la bibliothèque de liens dynamiques php_sqlsrv_72_ts_x64
    le point d'entrée de procédure add_index_zvalest introuvable dans la bibliothèque de liens dynamiques php_sqlsrv_72_ts_x64

  5. bro hello what is it?

    E:CustomPHPFramework-master>php artisan migrate

    PHP Warning: PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_72_ts_x64' (tried: C:xamppphpextphp_pdo_sqlsrv_72_ts_x64 (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜╨░ ╤Г╨║╨░╨╖╨░╨╜╨╜╨░╤П ╨┐╤А╨╛╤Ж╨╡╨┤╤Г╤А╨░.), C:xamppphpextphp_php_pdo_sqlsrv

    _72_ts_x64.dll (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜ ╤Г╨║╨░╨╖╨░╨╜╨╜╤Л╨╣ ╨╝╨╛╨┤╤Г╨╗╤М.)) in Unknown on line 0

    Warning: PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_72_ts_x64' (tried: C:xamppphpextphp_pdo_sqlsrv_72_ts_x64 (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜╨░ ╤Г╨║╨░╨╖╨░╨╜╨╜╨░╤П ╨┐╤А╨╛╤Ж╨╡╨┤╤Г╤А╨░.), C:xamppphpextphp_php_pdo_sqlsrv_72_t

    s_x64.dll (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜ ╤Г╨║╨░╨╖╨░╨╜╨╜╤Л╨╣ ╨╝╨╛╨┤╤Г╨╗╤М.)) in Unknown on line 0

    PHP Warning: PHP Startup: Unable to load dynamic library 'php_sqlsrv_72_ts_x64' (tried: C:xamppphpextphp_sqlsrv_72_ts_x64 (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜╨░ ╤Г╨║╨░╨╖╨░╨╜╨╜╨░╤П ╨┐╤А╨╛╤Ж╨╡╨┤╤Г╤А╨░.), C:xamppphpextphp_php_sqlsrv_72_ts_x64.d

    ll (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜ ╤Г╨║╨░╨╖╨░╨╜╨╜╤Л╨╣ ╨╝╨╛╨┤╤Г╨╗╤М.)) in Unknown on line 0

    Warning: PHP Startup: Unable to load dynamic library 'php_sqlsrv_72_ts_x64' (tried: C:xamppphpextphp_sqlsrv_72_ts_x64 (╨Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜╨░ ╤Г╨║╨░╨╖╨░╨╜╨╜╨░╤П ╨┐╤А╨╛╤Ж╨╡╨┤╤Г╤А╨░.), C:xamppphpextphp_php_sqlsrv_72_ts_x64.dll (╨

    Э╨╡ ╨╜╨░╨╣╨┤╨╡╨╜ ╤Г╨║╨░╨╖╨░╨╜╨╜╤Л╨╣ ╨╝╨╛╨┤╤Г╨╗╤М.)) in Unknown on line 0

    Could not open input file: artisan

    E:CustomPHPFramework-master>

    ?????

    DB_CONNECTION=sqlsrv

    DB_HOST=192.168.100.31

    DB_PORT=1433

    DB_DATABASE=wolf_stalkers

    DB_USERNAME=sa

    DB_PASSWORD=

    my settings in .env file

  6. I got an xampp error : unable to find the entry point _zval_ptr_dtor
    C:xamppphpextphp_pdo_sqlsrv_72_ts_x64.DLL

    I follow the tutorials, got everything : xampp, the dll files, the php.ini configure, but when I try to do request I got this message : IlluminateDatabaseQueryException

    could not find driver (SQL: select * from [dbo].[Log])
    my .env :
    DB_CONNECTION=sqlsrv

    DB_HOST=ip adresse
    DB_PORT=1433

    DB_DATABASE=database
    DB_USERNAME=read

    DB_PASSWORD=read

  7. Sir i've got this following error :

    C:UserspcDesktopBookingProjectvendorlaravelframeworksrcIlluminateDatabaseConnectorsConnector.php:70

    PDOException::("SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]SQL Server Network Interfaces: ")

    i have : laravel 7 , php 7.4 , MSsql 2016

  8. Something very very strange is happening on my Laravel 5.8
    IlluminateDatabaseQueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)
    PDOException::("could not find driver")

Leave a Reply

© 2023 53GB