Giter Site home page Giter Site logo

php-web's People

Contributors

arjun024 avatar cf-buildpacks-eng avatar chhhavi avatar dependabot-preview[bot] avatar dependabot[bot] avatar dfreilich avatar dwillist avatar foresteckhardt avatar joshzarrabi avatar kardolus avatar ndon55555 avatar oscarnevarezleal avatar paketo-bot avatar ryanmoran avatar sophiewigmore avatar thitch97 avatar wapacro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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

php-web's Issues

PORT environment variable seems not to exist while generating config

I'm trying to build a PHP application with following configuration:

buildpack.yml

php:
  version: 7.2.*
  webserver: nginx
  webdirectory: htdocs
  libdirectory: library
composer:
  install_options: []

with this command:

pack build myapplication \
  --builder gcr.io/paketo-buildpacks/builder:full-cf

The image is getting build but cannot be started because of the corrupt nginx.conf.

2020/06/26 12:39:45 [emerg] 22#0: host not found in "default_server" of the "listen" directive in /workspace/nginx.conf:135
process nginx exited, status: exit status 1

Here is the corresponding part from the nginx.conf:

    server {
        listen         default_server;
        server_name localhost;

        fastcgi_temp_path      /tmp/nginx_fastcgi 1 2;
        client_body_temp_path  /tmp/nginx_client_body 1 2;
        proxy_temp_path        /tmp/nginx_proxy 1 2;

The port number ist no being written to the config. I have the same problem with "php-server". Tried adding --env PORT=8080 to the command but it does not help.

Please detail how do I use a custom ini file in the Readme

It's not easy for users to understand how to use a custom ini file. The paketo docs says it sets PHP_INI_SCAN_DIR to a particular location but it's not intuitive to the user how to use it. (link). The readme should say how users can do it.
Also, this must be clearly stated in the paketo website docs.

Update README.md to reflect valid PHP versions

What happened?

README.md has the wrong PHP version on the example shown ( 10.x )

  • What were you attempting to do?
    I was about to send a PR but I wanted to create the issue first.

  • What did you expect to happen?
    Update the file

  • What was the actual behavior? Please provide log output, if possible.

Build Configuration

  • What platform (pack, kpack, tekton buildpacks plugin, etc.) are you
    using? Please include a version.

  • What buildpacks are you using? Please include versions.

  • What builder are you using? If custom, can you provide the output from pack inspect-builder <builder>?

  • Can you provide a sample app or relevant configuration (buildpack.yml,
    nginx.conf, etc.)?

Checklist

  • I have included log output.
  • The log output includes an error message.
  • I have included steps for reproduction.

Allow for PHP-FPM settings to be changed

What happened?

Attempting to update pm.max_children. The cf build packs allowed for a .bp-config directory to be added to override but I haven't found a similar override for paketo. I am aware that placing config in .php.ini.d overrides php settings but doesn't affect fpm settings.

  • What were you attempting to do?
    Change php-fpm settings.

  • What did you expect to happen?
    Override folder to allow for this.

  • What was the actual behavior? Please provide log output, if possible.
    No change in pm.max_children setting.

is it possible to reload procmgr process without restarting the container?

hi Guys,

So I have a docker container build with paketo PHP buildpack that runs the following command under PID 1

procmgr /layers/paketo-buildpacks_php-web/php-web/procs.yml

is it possible to reload the configs passed into procmgr somehow?

๐Ÿณ  [DEV] backend-v1-7476cc6cfd-l68p2 app # 
ps aufx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
cnb         30  1.0  0.0  18648  3444 pts/0    Ss   03:22   0:00 bash
cnb         77  0.0  0.0  34412  2944 pts/0    R+   03:22   0:00  \_ ps aufx
cnb          1  0.0  0.1 1013616 4096 ?        Ssl  03:20   0:00 procmgr /layers/paketo-buildpacks_php-web/php-web/procs.yml
cnb         24  0.0  0.7 323596 31260 ?        Ss   03:20   0:00 php-fpm: master process (/layers/paketo-buildpacks_php-web/php-web/etc/php-fpm.conf)
cnb         28  0.3  0.6 330252 24112 ?        S    03:20   0:00  \_ php-fpm: pool www
cnb         29  0.1  0.6 330016 23900 ?        S    03:20   0:00  \_ php-fpm: pool www
cnb         25  0.0  0.1  25132  5648 ?        S    03:20   0:00 nginx: master process nginx -p /workspace/app -c /workspace/app/nginx.conf
cnb         26  0.0  0.0  25132  1988 ?        S    03:20   0:00  \_ nginx: worker process
cnb         27  0.0  0.0  25132  1988 ?        S    03:20   0:00  \_ nginx: worker process

๐Ÿณ  [DEV] backend-v1-7476cc6cfd-l68p2 app # 
cat /layers/paketo-buildpacks_php-web/php-web/procs.yml
processes:
  nginx:
    command: nginx
    args:
    - -p
    - /workspace/app
    - -c
    - /workspace/app/nginx.conf
  php-fpm:
    command: php-fpm
    args:
    - -p
    - /layers/paketo-buildpacks_php-web/php-web
    - -y
    - /layers/paketo-buildpacks_php-web/php-web/etc/php-fpm.conf
    - -c
    - /layers/paketo-buildpacks_php-web/php-web/etc

Provide a FORCE_HTTPS option

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version?
capi 2.95.0

What version of the buildpack you are using?
master

If you were attempting to accomplish a task, what was it you were attempting to do?
Force redirect HTTP to HTTPS

What did you expect to happen?
Ideally, a mechanism similar to the one provided by the staticfile buildpack (FORCE_HTTPS). As an example, a FORCE_HTTPS option in options.json that automatically sets the relevant configuration in either apache or nginx would be the ideal outcome.

What was the actual behavior?
As a user, I have to know specifics about SSL termination done by my platform operator and I have to write custom httpd/nginx configuration

NGINX requirement should be top level in buildpack.yml

Currently this buildpack looks for the following field in buildpack.yml in order to enable the nginx feature and use NGINX as a webserver here.

---
php:
   webserver: nginx

This field is repetitive, we should just use the top level nginx field used in the nginx buildpack

---
nginx:
  version: 1.17.x

Mark as deprecated?

With the recent 1.0.0 release of Php, I believe this buidpack is no longer used. Shoud we mark it as deprecated (and maybe archive the repo)?

Please configure GITBOT

Pivotal provides the Gitbot service to synchronize issues and pull requests made against public GitHub repos with Pivotal Tracker projects.

If you do not want to use Pivotal Tracker to manage this GitHub repo, you do not need to take any action.

If you are a Pivotal employee, you can configure Gitbot to sync your GitHub repo to your Pivotal Tracker project with a pull request.

Steps:

  • Add the Toolsmiths-Bots team to have admin access to your repo
  • Add the cf-gitbot ([email protected]) user to have owner access to your Pivotal Tracker project
  • Create new branch in this repo: cfgitbot-config (an ask+cf@ ticket is the fastest way to get write access if you get a 404)
  • Add your new repo and or project to config-production.yml file
  • Submit a PR, which will get auto-merged if you've done it right. Detailed steps here

If you are not a pivotal employee, you can request that [email protected] set up the integration for you.

You might also be interested in configuring GitHub's Service Hook for Tracker on your repo so you can link your commits to Tracker stories. You can do this yourself by following the directions at:

https://www.pivotaltracker.com/help/articles/github_integration/

If there are any questions, please reach out to [email protected].

Make ProxyTimeout configurable for HTTPD & PHP-FPM

The HTTPD configuration that is generated by this cnb configures a default timeout of 60s.

https://github.com/cloudfoundry/php-web-cnb/blob/master/config/httpd.go#L99

If you have PHP processes that run longer than 60s, you will get a timeout because HTTPD will give up and stop waiting on PHP-FPM to return an answer.

This was a known issue with the php-buildpack, cloudfoundry/php-buildpack#212 (comment)

In that case with Cloud Foundry, we could configure a fixed timeout because we knew what Gorouter had configured for a timeout. For the CNBs, they can run in many places and behind many different LBs. It would make more sense to have a ProxyTimeout set in the configuration and allow it to be configurable through buildpack.yml.

Update module from cloudfoundry -> paketo-buildpacks

The current go.mod file references a github.com/cloudfoundry repo. Now that this repo lives in the paketo-buildpacks org, we should update the module name and the internal import statements in this codebase.

Nginx Root Location

Thoughts on adding a location / directives in the default nginx config? I'm not sure how many php applications can use this universally but I had to add one with a *-server.conf file to enable clean urls for Wordpress. We could even make it more dynamic to allow editing of the block.

Example

location / {
  #Wordpress pretty urls
  try_files $uri $uri/ /index.php?$args;

  include {{.AppRoot}}/.nginx.conf.d/*-location.conf;
}

The *-location is placeholder and could be named anything but this location directive turns on clean urls by default and allows users to add additional conf files to add rewrites, additional location directives under the root location, etc.

Of course the try_files portion is only applicable if it can be used universally for all php projects. I know laravel uses a similar try_files to enable clean urls as well.

Upgrade to packit v2

Please upgrade to the latest packit v2 release to enable new features and extended support.

Add deprecation warning for `buildpack.yml` usage

Per paketo-buildpacks/rfcs#58 (from RFC 0026) we are switching over the use of buildpack.yml configurations to environment variable-set configurations.

We should start this process for PHP by emitting a deprecation warning via log output about using the buildpack.yml setting that says:

WARNING: Setting the PHP configurations through buildpack.yml will be deprecated soon in the v1.0.0 release of this buildpack.

The v1.0.0 buildpack release will support setting various configurations through an environment variables instead.

We accomplish this in other buildpacks which can be used as an example for this issue.

Only app.php by default?

I understand this project + others are in flux; my question is inquisitive about intent and possibility and am also trying to learn how to write buildpacks; and submit useful PRs along the way

Historically the php-buildpack supported a range of default entrypoint .php scripts, including index.php (which is the example in https://docs.cloudfoundry.org/buildpacks/php/index.html).

The current implementation of php-web-cnb only supports app.php by default, else I see build error:

[builder] -----> PHP Web Buildpack 0.0.4
[builder] -----> Configuring PHP Script
[builder] -----> PHP Web e50003de403a58da1b3e060d24ad101578b1568c: Contributing to layer
[builder]        Writing PHPRC to shared
[builder]        Writing PHP_INI_SCAN_DIR to shared
[builder] WARNING: `app.php` start script not found. App will not start unless you specify a custom start command.
[builder] -----> Process types:
[builder]        task: php /workspace/app.php
[builder]        web:  php /workspace/app.php

And a runtime error:

Could not open input file: /workspace/app.php

This default comes from:

https://github.com/cloudfoundry/php-web-cnb/blob/49e03680fabd32e2f23a4a3ae903d7cc3e379d68/phpweb/phpweb.go#L76-L79

If we wanted to return to supporting more implicit entrypoint scripts (index.php), where would we do this? Do we first find index.php in cmd/detect, and if we find a supported implicit entrypoint then we'd pass it thru in the phpweb.ScriptDependency: buildplan.Dependency{}?

Support "listen ssl" directive in generated nginx.conf

What happened?

I'm trying to create a php app that uses nginx for SSL enabled http server. Right now I am able to do this by creating
a <app>/.nginx.conf.d/custom-server.conf with the following content:

ssl on;

ssl_certificate path/to/cert.pem;
ssl_certificate_key path/to//key.pem;

just like this.

But, the ssl directive is deprecated since 1.15.0. See http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl
The alternative is to have the listen directive include the ssl param like the following example:

listen 443 ssl;

However, this is not supported by this buildpack. See https://github.com/paketo-buildpacks/php-web/blob/v0.0.138/config/nginx.go#L154 - it does not allow the user to provide a configuration to add the "ssl" directive.

What do I expect?

I expect that the new way of turning os ssl is supported as a configuration option, and I don't see the following in the logs:

 [warn] 29#0: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /workspace/.nginx.conf.d/custom-server.conf:1

Templetize zlib.output_compression

What happened?

This buildpack includes a php.ini file that has zlib.output_compression set to "Off" with no way to enable it: https://github.com/paketo-buildpacks/php-web/blob/main/config/php-ini.go#L288

Since the php.ini file is already a template, is it easy to accept an option in buildpack.yml to enable zlib compression.

  • What were you attempting to do?

Create an image for Wordpress 5.6.1:

pack build wordpress  --builder paketobuildpacks/builder:full

with a directory structure like (htdocs is the extracted wordpress code):

$ ls .
buildpack.yml htdocs

and buildpack.yml:

---
php:
  script: index.php
  webserver: nginx
  webdirectory: htdocs
  • What did you expect to happen?

The built image should run fine.

  • What was the actual behavior? Please provide log output, if possible.

The image builds fine but when trying to run it I get the error:

2021/02/15 14:04:36 [error] 24#0: *4 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function gzinflate() in /workspace/source/app/htdocs/wp-includes/class-requests.php:949

Build Configuration

  • What platform (pack, kpack, tekton buildpacks plugin, etc.) are you
    using? Please include a version.

pack version: 0.17.0+git-d9cb4e7.build-2045

  • What buildpacks are you using? Please include versions

PHP 0.1.1

  • What builder are you using? If custom, can you provide the output from pack inspect-builder <builder>?
    upstream builder image: paketobuildpacks/builder@sha256:6ecfb5504194ca78d72ab760baa3e7547abb89febc731865c629e469bc6371f6

  • Can you provide a sample app or relevant configuration (buildpack.yml,
    nginx.conf, etc.)?

see above

Checklist

  • I have included log output.
  • The log output includes an error message.
  • I have included steps for reproduction.

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.