简体   繁体   中英

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 :

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 :

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...

First you need to change environment to flex and use custom runtime

add dockerfile

move your app to sub directory www

create sub directory config and create empty php.ini file inside him

download ioncube loader and move it to main directory

Direcotory :

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

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 :

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

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 :

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

edit dockerfile again :

# 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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