php-fpm issues (container runtime)

Open
#404 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php, shell

Research direction

Start with 8.1/s2i/bin/run at lines 59-68 and reproduce the assembled container's non-root runtime errors shown in the issue. Trace the PHP-FPM directory, log, symlink, and permission operations; done means the runtime path works without the reported chmod/chown failures and handles the log path creation order correctly.

Written by the indexing model from the issue text.

Description

bug P1

Logic issues with the following

https://github.com/sclorg/s2i-php-container/blob/master/8.1/s2i/bin/run#L59-L68

if [ "x$PLATFORM" == "xel9" ] || [ "x$PLATFORM" == "xfedora" ]; then
  if [ -n "${PHP_FPM_RUN_DIR:-}" ]; then
    /bin/ln -s /dev/stderr ${PHP_FPM_LOG_PATH}/error.log
    mkdir -p ${PHP_FPM_RUN_DIR}
    chmod -R a+rwx ${PHP_FPM_RUN_DIR}
    chown -R 1001:0 ${PHP_FPM_RUN_DIR}
    mkdir -p ${PHP_FPM_LOG_PATH}
    chmod -R a+rwx ${PHP_FPM_LOG_PATH}
    chown -R 1001:0 ${PHP_FPM_LOG_PATH}
  fi

fi

On runtime it's trying to create folders and set permissions in an immutable object, shouldn't this be in the assemble script and not at runtime?

Also there's functional issues such as trying to symlink to the error.log before the mkdir runs on the ${PHP_FPM_LOG_PATH} but the bigger issue is this won't run inside the assembled container as the following output indicates running as non root.

chmod: changing permissions of '/run/php-fpm': Operation not permitted
chown: changing ownership of '/run/php-fpm': Operation not permitted
chmod: changing permissions of '/var/log/php-fpm': Operation not permitted
chown: changing ownership of '/var/log/php-fpm/error.log': Operation not permitted
chown: changing ownership of '/var/log/php-fpm': Operation not permitted
Dominant language
Shell
Stars
114
Forks
326
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sclorg/s2i-php-container

All issues in sclorg/s2i-php-container

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.