Skip to content

error installing oci8 in php8.1-apache docker image #1319

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

Closed
LucaMicelloneUnito opened this issue Jul 25, 2022 · 2 comments
Closed

error installing oci8 in php8.1-apache docker image #1319

LucaMicelloneUnito opened this issue Jul 25, 2022 · 2 comments
Labels
question Usability question, not directly related to an error with the image

Comments

@LucaMicelloneUnito
Copy link

LucaMicelloneUnito commented Jul 25, 2022

I have an error when I use "FROM php:8.1-apache" and try to install oci8 for oracle.

I follow these steps;

  1. download from oracle https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-basic-linux.x64-21.6.0.0.0dbru.zip and https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip
  2. unzip instantclient-basic-linux.x64-21.6.0.0.0dbru.zip and instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip in folder /opt/oracle/instantclient
  3. launch command echo 'instantclient,/opt/oracle/instantclient' | pecl install oci8-3.2.1

After this command there is an error: Fatal error: Uncaught Error: Call to undefined function exec() in /usr/local/lib/php/PEAR/Builder.php:465

[...]
Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1" install
Installing shared extensions:     /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local/lib/php/extensions/no-debug-non-zts-20210902/
running: find "/tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1" | xargs ls -dils
4719924   4 drwxr-xr-x 3 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1
4719961   4 drwxr-xr-x 3 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr
4719962   4 drwxr-xr-x 3 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local
4719963   4 drwxr-xr-x 3 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local/lib
4719964   4 drwxr-xr-x 3 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local/lib/php
4719965   4 drwxr-xr-x 3 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local/lib/php/extensions
4719966   4 drwxr-xr-x 2 root root   4096 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local/lib/php/extensions/no-debug-non-zts-20210902
4719960 828 -rwxr-xr-x 1 root root 844024 Jul 25 14:36 /tmp/pear/temp/pear-build-defaultuservlzPxQ/install-oci8-3.2.1/usr/local/lib/php/extensions/no-debug-non-zts-20210902/oci8.so

Fatal error: Uncaught Error: Call to undefined function exec() in /usr/local/lib/php/PEAR/Builder.php:465
Stack trace:
#0 /usr/local/lib/php/PEAR/Installer.php(1521): PEAR_Builder->build('/tmp/pear/temp/...', Array)
#1 /usr/local/lib/php/PEAR/Installer.php(1416): PEAR_Installer->_compileSourceFiles('pecl.php.net', Object(PEAR_PackageFile_v2), '')
#2 /usr/local/lib/php/PEAR/Command/Install.php(718): PEAR_Installer->install('/tmp/pear/downl...', Array)
#3 /usr/local/lib/php/PEAR/Command/Common.php(270): PEAR_Command_Install->doInstall('install', Array, Array)
#4 /usr/local/lib/php/pearcmd.php(310): PEAR_Command_Common->run('install', Array, Array)
#5 /usr/local/lib/php/peclcmd.php(32): require_once('/usr/local/lib/...')
#6 {main}
  thrown in /usr/local/lib/php/PEAR/Builder.php on line 465

The same command with php7.4-apache echo 'instantclient,/opt/oracle/instantclient' | pecl install oci8-2.2.0 works.

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Jul 25, 2022
@wglambert
Copy link

Try this

FROM php:8.1-apache
RUN apt update && apt install -y wget unzip libaio1 && rm -rf /var/lib/apt/lists/*
RUN cd /tmp/ && wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-basic-linux.x64-21.6.0.0.0dbru.zip && \
    wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip && \
    unzip '*.zip' && \
    rm *.zip
RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/tmp/instantclient_21_6/
RUN docker-php-ext-install oci8 && \
    echo /tmp/instantclient_21_6 > /etc/ld.so.conf.d/oracle.conf && \
    ldconfig
$ docker build . -t php:oci8
Sending build context to Docker daemon   2.56kB
Step 1/5 : FROM php:8.1-apache
 ---> 76fa555fcac9
Step 2/5 : RUN apt update && apt install -y wget unzip libaio1 && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> fbad679c890a
Step 3/5 : RUN cd /tmp/ && wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-basic-linux.x64-21.6.0.0.0dbru.zip &&     wget https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-sdk-linux.x64-21.6.0.0.0dbru.zip &&     unzip '*.zip' &&     rm *.zip
 ---> Using cache
 ---> 97bcb93fa37c
Step 4/5 : RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/tmp/instantclient_21_6/
 ---> Using cache
 ---> b091cedf6480
Step 5/5 : RUN docker-php-ext-install oci8 &&     echo /tmp/instantclient_21_6 > /etc/ld.so.conf.d/oracle.conf &&     ldconfig
 ---> Using cache
 ---> 7bde7bef1be3
Successfully built 7bde7bef1be3
Successfully tagged php:oci8

$ docker run --rm php:oci8 php -i | grep -i oci
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini,
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 3.1.0
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20

@LucaMicelloneUnito
Copy link
Author

now it works !!!
Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

2 participants