Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to enable openswoole with option enable-sockets="yes" #70

Open
sebk69 opened this issue Dec 22, 2023 · 0 comments
Open

Unable to enable openswoole with option enable-sockets="yes" #70

sebk69 opened this issue Dec 22, 2023 · 0 comments

Comments

@sebk69
Copy link

sebk69 commented Dec 22, 2023

got php startup error when install openswoole whith sockets enabled.

Here is my Dockerfile :

FROM php:8.2-cli-bullseye

# args
ARG uid=1001
ARG timezone=Europe/Paris
ARG memory_limit=1G
ARG app_name=openswoole-skeleton
ARG app_env=dev

# install openswoole
RUN apt-get update && \
    apt-get install openssl -y && \
    apt-get install libssl-dev -y && \
    apt-get install libcurl4-openssl-dev -y
RUN docker-php-ext-install sockets
RUN pecl install -D 'enable-sockets="yes" enable-openssl="yes" enable-http2="yes" enable-hook-curl="yes"' openswoole && \
    docker-php-ext-enable openswoole

# install pcov
RUN bash -c "if [ \"$app_env\" == \"dev\" ]; then pecl install pcov; docker-php-ext-enable pcov; echo \"pcov enabled\"; fi"

# install gd
RUN apt-get update && apt-get install -y zlib1g-dev libpng-dev libzip-dev libfreetype-dev fonts-arkpandora
RUN docker-php-ext-configure gd --with-freetype
RUN docker-php-ext-install gd

# install zip
RUN docker-php-ext-install zip

# Php ini
RUN echo "memory_limit = $memory_limit" >> /usr/local/etc/php/conf.d/docker-php-ram-limit.ini
RUN echo 'display_errors=E_ALL & ~E_DEPRECATED' >> /usr/local/etc/php/conf.d/docker-php-error-reporting.ini

# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php --install-dir=/usr/bin --filename=composer

# Set timezone
RUN cp /usr/share/zoneinfo/$timezone /etc/localtime \
    && echo "$timezone" > /etc/timezone \
    && echo "[Date]\ndate.timezone=$timezone" > /usr/local/etc/php/conf.d/timezone.ini

# Install packages
RUN apt-get update && apt-get install -y curl sudo wget git vim zip unzip procps && rm -rf /var/lib/apt/lists/*

# supervisor
RUN apt-get update && apt-get install -y supervisor

# Setup app
COPY ./src /usr/src/$app_name
RUN usermod -u $uid www-data
RUN chown www-data:www-data /var/www
RUN chown -R www-data:www-data /usr/src/$app_name
WORKDIR /usr/src/$app_name

# healthcheck
COPY ./docker/healthcheck /opt/healthcheck
RUN chown 755 /opt/healthcheck
HEALTHCHECK --interval=5s --timeout=3s CMD bash /opt/healthcheck

ENTRYPOINT sleep infinity

Here is composer error :

Warning: PHP Startup: Unable to load dynamic library 'openswoole' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole.so: undefined symbol: socket_ce)) in Unknown on line 0
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires openswoole/core >=22.1.5 -> satisfiable by openswoole/core[22.1.5].
    - openswoole/core 22.1.5 requires ext-openswoole >=22.0 -> it is missing from your system. Install or enable PHP's openswoole extension.

To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/conf.d/docker-php-error-reporting.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-gd.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-openswoole.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
    - /usr/local/etc/php/conf.d/docker-php-ram-limit.ini
    - /usr/local/etc/php/conf.d/timezone.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-openswoole` to temporarily ignore these required extensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant