Hello, I’m having a really hard time trying to install the snowflake pdo driver inside the php-fpm container.
The driver I’m trying to setup is:
I’m currently using the following image:
devilbox/php-fpm:8.0-prod
My currently project is Yii2-Advanced, one of the DB connections requires connection to snowflake, I’ve tried to do workarounds but my phpstorm does not recognize the module when I try to debug through the CLI.
This is the configuration PHPSTORM sees inside the container:
If I run the command inside the container the connection works, but seems PHPSTORM is not detecting custom modules.
This should be included as an additional PDO module inside devilbox
I was able to make it work, this is what I added in the PHP Dockerfile:
####### SNOWFLAKE CONFIG START #######
# Set env path
ENV PHP_HOME="/usr/local"
# make tmp folder and clone the pdo_snowflake repo
RUN mkdir /tmp/snowflake \
&& git clone https://github.com/snowflakedb/pdo_snowflake.git /tmp/snowflake
# 1) run the compile command
# 2) move the compiled lib and cert to extensions dir
# 3) create local directory to save certificate
RUN export PHP_HOME \
&& bash /tmp/snowflake/scripts/build_pdo_snowflake.sh \
&& cp /tmp/snowflake/libsnowflakeclient/cacert.pem /tmp/snowflake/modules/pdo_snowflake.so /usr/local/lib/php/extensions/no-debug-non-zts-*/ \
&& mkdir /etc/php-snowflake \
&& cp /tmp/snowflake/libsnowflakeclient/cacert.pem /etc/php-snowflake/cacert.pem \
&& rm -rf /tmp/snowflake
COPY ["./conf.d/pdo_snowflake.ini","/usr/local/etc/php/conf.d/pdo_snowflake.ini"]
####### SNOWFLAKE CONFIG END #######
keep in mind that you need to provide the pdo_snowflake.ini file, for this just create a file in your project and add the following lines:
extension=pdo_snowflake.so
pdo_snowflake.cacert=/etc/php-snowflake/cacert.pem