Giter Club home page Giter Club logo

php-docker's Introduction

Docker image for the App Engine Flexible PHP runtime

This repository contains a PHP runtime for Google App Engine Flexible Environment and other Docker hosts. It is not covered by any SLA or deprecation policy. It may change at any time.

Contributing changes

Licensing

php-docker's People

Contributors

akerekes avatar bendory avatar bshaffer avatar carusogabriel avatar cedricziel avatar chingor13 avatar deustis avatar dlorenc avatar donmccasland avatar frost-byte avatar ibrunotome avatar imjasonh avatar jaitaiwan avatar jinglundong avatar justinbeckwith avatar nkubala avatar paumas avatar pmaloogoogle avatar raggi avatar sharifelgamal avatar sjlangley avatar urakozz avatar wesrice avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-docker's Issues

Add e2e tests

  • Deploying with gcloud
    • local (--docker-build=local, and use FROM php-nginx, so that using local build)
    • remote (--docker-build=remote, upload the image with a different name)
  • Web serving

PHP Extensions should be implicitly installable through composer.json

In order to maintain dependencies to shared PHP extensions, composer packages may define ext-* dependencies, like ext-mbstring-just like they may define a dependency on a interpreter-version.

The image build-process should be able to read those and add the corresponding extension directive to the top-level php.ini so that the developer doesn't need to add a php.ini file for already explicitly defined dependencies.

issues logging to stdout?

Logging to STDOUT is not showing up in the log files. When on an instance itself, I see none of the expected logs under /var/log/app_engine, but they are instead under /var/log/app_engine/app:

screen shot 2016-01-06 at 2 56 43 pm

If I run sudo docker logs [CONTAINER], I see the same logs as I see in the Cloud Logging UI, but none of my application logs show up here.

Additional VCS packages needed

This is a followup issue to #18 .

Composer supports several different VCS drivers (listed here).

Git was introduced in #18, but the remaining VCS packages should be included into the images as well.

remove parse_str from blacklist

We should remove parse_str from the suhosin blacklist.

As @tmatsuo mentioned, if used in a certain way, it's possible for this function to override global variables. However, we need to keep in mind:

  1. The function can be used safely when a second argument is supplied
  2. The function is very common, as it's the only way (other than rolling your own) to parse a query string.
  3. The dangers of using this function require the user to be doing a few other things incorrectly to do damage, namely not providing a 2nd argument to parse_str and relying on global scope throughout the app.

It would be best to remove this function from the blacklist. The best solution would be to disable the function's ability to be used without a second argument, but this is out of scope.

Reintroduce scripts to composer install

We added --no-scripts to the composer install commmand in #69. Why did we do this?

This could be a very way for users to run simple pre-deployment tasks (such as changing file permissions, warming up caches, etc) without having to extent the Dockerfile. We can add --no-interaction to the composer install command, to ensure the build can complete.

@cedricziel

Run `composer install` as `www-data`

We should not run composer as root. www-data is not a valid login, so we may need to create a temporary user account with the same id, and delete it after that; or temporary chsh www-data's shell.

See also #135

Docker build refactoring

  • split build_deps.sh into pieces so that each step has its own layer
  • change how to install extensions
    it might be better installing extensions after installing the interpreter
  • Only delete /var/lib/apt/lists/* once

Docker: Composer doesn't use supplied php.ini

The supplied composer runner doesnt respect the supplied php.ini which makes it really hard to run post-install scripts that utilize for example symfony/console to generate optimized autoloaders (example: Laravel 5.1)

[Symfony\Component\Process\Exception\RuntimeException]
The Process class relies on proc_open, which is not available on your PHP installation.

I see that you've disabled the function on purpose, but really they shouldnt be limited on the CLI for one-off commands.

From my point of view, there's multiple possible solutions to the problem:

  1. use the supplied php.ini to allow save overrides
  2. use another php.ini (for example php.cli.ini) just for composer
  3. use another ini setting on the cli
  4. override the contained php.ini in the image

I know I can override the supplied php.ini - maybe just document it to make it easier for people who are not into docker very much?

Pre-compile the PHP binaries

It is too slow to compile multiple PHP versions for each Docker build. Can we pre-compile the PHP binaries, upload and download from GCS or somewhere?

Use stable php-cs-fixer

We can just use the phar, but it's better to install it via composer with an explicit version.

Provide a script for easy debugging

script may

  • install vim
  • loosen php for cli access
  • Other idea welcome

How you can use it,
You can ssh into the VM, get into the container and run the script, then you'll be able to debug your app easily.

Add FRONT_CONTROLLER_FILE for nginx configuration

Often we have to create an nginx-app.conf file just to change the name of the front controller. Some frameworks use index.php, some use app.php, etc.

We could introduce another envvar like FRONT_CONTROLLER_FILE, so that you can do:

app.yaml

runtime: php
vm: true

runtime_config:
  document_root: web

env_variables:
  WHITELIST_FUNCTIONS: libxml_disable_entity_loader
  FRONT_CONTROLLER_FILE: app.php

see GoogleCloudPlatform/php-docs-samples#190

Credentials handling

In my application, I have reached a state where all needed secrets are received from the project-level metadata store - do you think that's a good practice? The description about the metadata store states that it's secure since it's close to local to the compute unit.

Another approach would be to add secrets via environment variables - but it has the implication that I need to write those down to the app.yaml file and thus need to access them on the ci server at deployment time.

Do you prefer one method over the other for AppEngine flex deployments? I guess that's more a RFC than a real issue :)

Difficulties with more than one service per app

It is difficult to use this runtime to deploy more than one service per app to AppEngine, due to the requirement of each service to share nginx-app.conf php.ini and supervisord.conf files.

We could add a runtime_config variable conf_dir that can be used to change the configuration dir from the default (/app) to something else (like /app/config/my_service)

Consider using user ini mechanism

Instead of completely replacing the factory default php.ini of the image, it should be considered to use the "user ini" mechanism to allow fine grained control over just a few ini settings.

[Q] General direction of the image

I have an important question while I try to bend this image to my needs: What is the feature-complete state of this image?

The heroku buildpack for php is a really great source of inspiration in terms of what is possible and needed for running modern, sophisticated php applications on the platform side of things. I am aware that it may slightly conflict with the "many tiny applications"-paradigm Google drives, but I'm curious if you are willing to go towards that direction with this image as well.

I'd like you to take a look at the compile script of the heroku buildpack for php to see some of the features it detects. (https://github.com/heroku/heroku-buildpack-php/blob/master/bin/compile)

I am aware that I can run a docker image with a heroku buildpack on managed vms - but apart from the general, language specific features, I would also expect AppEngine features from the sandbox to get integrated in the future with this image (CloudSQL with a simple socket). If it wasn't for those, I'd just use the one of the heroku flavoured docker images with managed vms.

Native memached session handler broken in PHP7?

So basically I'm having trouble with the registered native session handler. I run an image with symfony2 3.0 and operating on the session fails silently.

I propose to add an end-to-end test for PHP7 that includes memcached operations.

e2e test warns

WARNING: This command is deprecated. Please use gcloud preview app versions delete instead.

function spl_autoload_register disabled

I am receiving the following error with the default configuration:

WARNING: [pool app] child 20 said into stderr: "NOTICE: PHP message: PHP Warning: spl_autoload_register() has been disabled for security reasons in /app/vendor/composer/autoload_real.php on line 22"

This a core function used in composer for certain types of autoloading, so it is important we allow it. It should be whitelisted by default.

Applications cannot write to their own filesystem

Booting a simple Laravel5 application results in errors, because it wants to cache the current container to $APP_ROOT/bootstrap/cache/services.json and file_put_contents fails.

Here's an application illustrating the issue: https://github.com/cedricziel/gae-docker-writable-issue

Just deploy it to AppEngine and open up the index route.

The underlying issue seems to be that though permissions seem correct, the application cannot write to the filesystem. While this could be fixed on build-time for this particular application, one of the promises managed vms make is a writable file system so applications caching files to disk don't have to jump through hoops.

PHP binaries are not on $PATH

In order to be able to execute arbitrary commands, the php binaries need to be on PATH. This applies to inheriting images as well, so it doesn't seem sufficient to export a modified PATH in the composer script, if an inheriting image would want to compile pecl extensions.

Unable to get memcached working with wordpress

@tmatsuo first of all thanks for the helpful guide to get onto the flex runtime: https://wp.gaeflex.ninja/2016/03/14/running-wordpress-on-flex/

However, we are running into an issue with memcache and the current version of the php flex runtime. The PHP startup according to the cloud logs doesn't seem to like the path of memcache.so. Ultimately, this leads to errors when trying to use the memcached / bataches plugins.

[21-Sep-2016 13:19:07 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/php56/lib/php/extensions/no-debug-non-zts-20131226/memcached.so' - /opt/php56/lib/php/extensions/no-debug-non-zts-20131226/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
 {
 metadata: {โ€ฆ}   
 textPayload: "[21-Sep-2016 13:19:07 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/php56/lib/php/extensions/no-debug-non-zts-20131226/memcached.so' - /opt/php56/lib/php/extensions/no-debug-non-zts-20131226/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0"   
 insertId: "1e89dixg83omuqn"   
 log: "appengine.googleapis.com/app"   
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.