Kudu: Equalize PHP Modules between Kudu Linux Containers and App Service Linux Containers

Created on 19 Feb 2020  路  4Comments  路  Source: projectkudu/kudu

Hello.

I think this behavior was already mentioned in other issues (#2702 and #3112 ). Basically, it is important that the PHP modules available to the Linux App Service container on Azure should be also available under the Kudu Container as well, in order to avoid deployment issues.

In my example below, I am able to run this command (php artisan migrate) via SSH on the Linux App Service; however, the same cannot be said when running this very command via Kudu Bash. I also tried via deploy.sh script and also via Post Deployment Action on a DevOps Pipeline AzureRmWebAppDeployment@4 action.

This command will fail because on the Kudu container there is no "sqlsrv" PHP module installed, as opposed to the Linux App Service container. Actually there are several other modules missing on Kudu that are present in App Service, we can see it clearly when running the command "php -m" on both, here are the results:

  • php -m on Linux App Service SSH:
Cannot load Zend OPcache - it was already loaded
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pdo_sqlsrv
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
sqlsrv
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
  • php -m on Kudu container:
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

"Artisan Migrate" is an important post deployment action in any Laravel project, hence should be possible to execute it via Kudu container. So equalizing all the PHP Modules between both would resolve this issue (or at least equalizing all the SQL related modules).

Thanks

Repro steps.

login on Azure Portal > App Services > select your (linux PHP) App Service > Advanced tools > Go
select "Bash" and run the following commands
cd /home/site/wwwroot
php artisan migrate --force

Project structures.

standard Azure App Service with Linux and PHP 7.3
framework: Laravel
database: SQL Server (sqlsrv)

The log/error given by the failure.

Illuminate\Database\QueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = TabMigrations)

at /home/site/wwwroot/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669

All 4 comments

Any updates on the matter?

Any updates on the matter?

The issue is still present and filling up my error logs unnecessarily.

Will this ever be fixed?

Add @sanchitmehta - could you help with above?

Was this page helpful?
0 / 5 - 0 ratings