Mateus Galasso
Mateus Galasso

Reputation: 348

Laravel 5.7 Apache 2.4 php 7.2 Undefined class constant 'SQLSRV_ATTR_FETCHES_NUMERIC_TYPE'

I'm trying to configure my Laravel 5.7 in Apache 2.4 using PHP 7.2 but i'm getting the error

Undefined class constant 'SQLSRV_ATTR_FETCHES_NUMERIC_TYPE'

I've already change de PHP version to 7.1 Put the lines LoadModule php7_module "C:/Apache24/php/php7apache2_4.dll" AddHandler application/x-httpd-php .php PHPIniDir C:/Apache24/php on httpd.conf in apache

this is my php.ini

;extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=gettext
;extension=gmp
extension=intl
extension=imap
;extension=interbase
extension=ldap
extension=mbstring
extension=exif      
extension=mysqli
;extension=oci8_12c
extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=shmop

;extension=snmp

;extension=soap
;extension=sockets
;extension=sqlite3
extension=tidy
extension=xmlrpc
extension=xsl

extension=php_sqlsrv_72_ts
extension=php_pdo_sqlsrv_72_ts

extension_dir = "ext"

These are my modules

[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
gettext
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlsrv
Phar
readline
Reflection
session
SimpleXML
SPL
sqlsrv
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]

When I use

php artisan serve

works fine

EDITED

Seems that extensions is not been loaded. I did phpinfo() and didn't show pdo_sqlsrv

Upvotes: 1

Views: 3734

Answers (1)

Raees
Raees

Reputation: 29

I have done by repeating these 3 steps on Ubuntu

  1. Register the Microsoft Linux repositories and add their keys.

      curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
    
      curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | sudo tee /etc/apt/sources.list.d/mssql-server-2017.list
    
  2. Install SQL Server.

      sudo apt-get update
    
      sudo apt-get install mssql-server
    
  3. Setup your SQL Server.

      sudo /opt/mssql/bin/mssql-conf setup
    

For more detail

Microsoft Guide

Upvotes: 0

Related Questions