为什么App Engine没有SQL Server驱动程序?

时间:2018-12-04 14:36:09

标签: php google-app-engine google-cloud-platform google-flexible

我正在尝试在App Engine Flex的PHP的自定义运行时上安装SQL Server驱动程序。 如果我忽略Nginx conf文件的位置,它将下载更正index.php页面(这是一个Laravel应用)。如果没有任何Nginx conf文件,它将假定在我的应用程序的根目录下查找index.php。我的问题是,App Flex Engine如何处理自定义PHP运行时?我需要一个nginx.conf文件吗?我收到一个地址已经绑定的错误。

这是我的Dockerfile;

FROM gcr.io/google-appengine/php
RUN mkdir -p /usr/share/nginx/www/
ADD . /usr/share/nginx/www/
RUN chmod -R a+r /usr/share/nginx/www

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN apt-get update && apt-get -y install apt-transport-https curl
RUN curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
RUN exit
RUN apt-get update -y
RUN ACCEPT_EULA=Y apt-get install msodbcsql17 -y
RUN pecl channel-update pecl.php.net
RUN apt-get install unixodbc-dev -y
RUN apt-get install autoconf -y
RUN apt-get install build-essential -y
RUN apt-get install gcc -y
RUN apt-get install g++ -y
RUN pecl install sqlsrv
RUN pecl install pdo_sqlsrv
RUN echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini
RUN echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini
RUN mkdir -p /usr/share/nginx/www/_ah && \
    echo "healthy" > /usr/share/nginx/www/_ah/health
EXPOSE 8080

和我的Nginx文件

# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # Logs will appear on the Google Developer's Console when logged to this
    # directory.
    access_log /var/log/app_engine/app.log;
    error_log /var/log/app_engine/app.log;

    gzip on;
    gzip_disable "msie6";

    server {
        # Google App Engine expects the runtime to serve HTTP traffic from
        # port 8080.
        listen 8080;
        root /usr/share/nginx/www/public;
        index index.html index.htm index.php;
        location / {
          try_files $uri?$args $uri/index.php?$args;
        }
    }
}

0 个答案:

没有答案