简体   繁体   English

PHP:在GAE标准环境中启用Ioncube加载程序扩展

[英]PHP : enable Ioncube loader extension in GAE standard environment

I have issue in enable ioncube loader extension in google app engine standard envirenement, I get this error : 我在Google App Engine标准环境中启用ioncube loader扩展程序时遇到问题,出现此错误:

NOTICE: PHP message: PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0

I already added it in first of php.ini file : 我已经在php.ini文件的第一个中添加了它:

zend_extension = /srv/modules/ioncube_loader_lin_7.2.so
asp_tags = Off
display_errors = Off
max_execution_time = 3600
max_input_time = 3600
max_input_vars = 1000
memory_limit = 512M
post_max_size = 128M
session.gc_maxlifetime = 1440
upload_max_filesize = 1G
zlib.output_compression = On

I think I need to add it in default php.ini file to execute at first but I dont know how to rewrite default php.ini file or replace it... 我想我需要先将其添加到默认php.ini文件中才能执行,但我不知道如何重写默认php.ini文件或将其替换...

First you need to change environment to flex and use custom runtime 首先,您需要更改环境以灵活使用自定义运行时

add dockerfile 添加dockerfile

move your app to sub directory www 将您的应用移动到子目录www

create sub directory config and create empty php.ini file inside him 创建子目录配置并在其中创建空的php.ini文件

download ioncube loader and move it to main directory 下载ioncube loader并将其移至主目录

Direcotory : 目录:

-config
   php.ini
-www
app.yaml
composer.json
dockerfile
ioncube_loader_lin_7.2.so

app.yaml : app.yaml:

runtime: custom
env: flex

runtime_config:
  document_root: www
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

composer.json : composer.json:

{
  "require": {
    "php": "7.2.*"
  }
}

Dockerfile : Dockerfile的:

# Dockerfile extending the generic PHP image with application files for a
# single application.
FROM gcr.io/google-appengine/php:latest
# environment variable.
ENV DOCUMENT_ROOT /app/www
# copy default php.ini to txt file
RUN cp /opt/php72/lib/php.ini www/phpconfig.txt

after that deploy your application and navigate txt file url "yourdomain.com/phpconfig.txt" copy contain and add it to your config/php.ini don't forget add ioncube in first line : 之后,部署您的应用程序并导航txt文件url“ yourdomain.com/phpconfig.txt”副本,将其包含并添加到您的config / php.ini中,不要忘了在第一行添加ioncube:

zend_extension = "/app/ioncube_loader_lin_7.2.so"

edit dockerfile again : 再次编辑dockerfile:

# Dockerfile extending the generic PHP image with application files for a
# single application.
FROM gcr.io/google-appengine/php:latest
# environment variable.
ENV DOCUMENT_ROOT /app/www
COPY config/php.ini /opt/php72/lib/php.ini

and deploy your application thats all. 并部署您的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM