s2i-php-container icon indicating copy to clipboard operation
s2i-php-container copied to clipboard

php-fpm issues (container runtime)

Open paulbadcock opened this issue 3 years ago • 4 comments

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

paulbadcock avatar Mar 20 '23 19:03 paulbadcock

@remicollet Can you please provide to @paulbadcock why mod_php on RHEL8 is enabled instead of FPM? Personally, I could not find this information. It could be added to the README.md.

@paulbadcock Is it related to RHEL8 or RHEL9? I can not find this information in the issue. Do you have a Bugzilla?

phracek avatar Mar 27 '23 13:03 phracek

@remicollet Can you please provide to @paulbadcock why mod_php on RHEL8 is enabled instead of FPM?

This was a choice (not mine) to avoid complexity in first EL8 image

EL9 use FPM as mod_php is no more available

Other may exist in the future (such as 1 container for webserver, 1 for php backend...)

remicollet avatar Mar 27 '23 14:03 remicollet

@remicollet Can you please provide to @paulbadcock why mod_php on RHEL8 is enabled instead of FPM? Personally, I could not find this information. It could be added to the README.md.

@paulbadcock Is it related to RHEL8 or RHEL9? I can not find this information in the issue. Do you have a Bugzilla?

RHEL9, no bugzilla

paulbadcock avatar May 02 '23 20:05 paulbadcock

We are encountering the same issue. It is unclear to me if this is also the reason why no PHP logs show up in stdout/stderr

roemba avatar Jun 30 '23 11:06 roemba