Coder Social home page Coder Social logo

adrianharabula / php-oci8 Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 34.0 111.82 MB

Official Docker PHP image with Oracle Instant Client and OCI8

Home Page: https://hub.docker.com/r/adrianharabula/php7-with-oci8

PHP 2.72% Dockerfile 97.28%
docker oci8 php

php-oci8's Issues

Fatal error: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/html/public/index.php on line 7

When I try to access oracle db from SQLDeveloper tool, It is working but
when I trying to connect with provided php script. It is throwing error below.

Fatal error: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/html/public/index.php on line 7

<?php
//phpinfo(); exit;

$conn = oci_connect('system', 'oracle', 'oracledb/XE');
if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else echo 'succesful';

exit;

Unable to run oracle client for 32 bit

Dockerfile:

FROM php:7.2-apache-stretch

RUN apt-get update && apt-get install -y \
        unzip \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libmcrypt
        libpng-dev \
        libaio1 \
    && docker-php-ext-install -j$(nproc) iconv mcrypt gettext \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

RUN curl -L https://raw.github.com/adrianharabula/php7-with-oci8/master/docker-php.conf -o /etc/apache2/conf-enabled/docker-php.conf

RUN printf "log_errors = On \nerror_log = /dev/stderr\n" > /usr/local/etc/php/conf.d/php-logs.ini

RUN a2enmod rewrite

RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/1911000/instantclient-basiclite-linux-19.11.0.0.0dbru.zip -O
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/1911000/instantclient-sdk-linux-19.11.0.0.0dbru.zip -O
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/1911000/instantclient-sqlplus-linux-19.11.0.0.0dbru.zip -O

RUN unzip /tmp/instantclient-basiclite-linux-19.11.0.0.0dbru.zip -d /usr/local/
RUN unzip /tmp/instantclient-sdk-linux-19.11.0.0.0dbru.zip -d /usr/local/
RUN unzip /tmp/instantclient-sqlplus-linux-19.11.0.0.0dbru.zip -d /usr/local/instantclient_19_11

RUN ln -s /usr/local/instantclient_19_11 /usr/local/instantclient
# fixes error "libnnz19.so: cannot open shared object file: No such file or directory"
RUN ln -s /usr/local/instantclient_19_11/sdk /usr/lib
RUN ln -s /usr/local/instantclient_19_11/instantclient_19_11 /usr/bin/sqlplus

RUN echo 'export LD_LIBRARY_PATH="/usr/local/instantclient_19_11"' >> /root/.bashrc
RUN echo 'umask 002' >> /root/.bashrc

RUN echo 'instantclient_19_11,/usr/local/instantclient_19_11' | pecl install oci8-2.2.0
RUN echo "extension=oci8.so" > /usr/local/etc/php/conf.d/php-oci8.ini

RUN echo "<?php echo phpinfo(); ?>" > /var/www/html/phpinfo.php



EXPOSE 80

cannot install packages

hi
i tried to install some oci8 wrapper with composer but keep getting error
how to add some cli on php-apache image
i keep stuck in here. any insight would be appreciated.

here is the error i got:
`composer require yajra/laravel-oci8
Using version ^5.5 for yajra/laravel-oci8
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- yajra/laravel-oci8 v5.5.6 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- yajra/laravel-oci8 v5.5.5 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- yajra/laravel-oci8 v5.5.4 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- yajra/laravel-oci8 v5.5.3 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- yajra/laravel-oci8 v5.5.2 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- yajra/laravel-oci8 v5.5.1 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- yajra/laravel-oci8 v5.5.0 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.
- Installation request for yajra/laravel-oci8 ^5.5 -> satisfiable by yajra/laravel-oci8[v5.5.0, v5.5.1, v5.5.2, v5.5.3, v5.5.4, v5.5.5, v5.5.6].

To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/15-xml.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-dom.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-pdo_pgsql.ini
- /etc/php/7.0/cli/conf.d/20-pgsql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-simplexml.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/cli/conf.d/20-wddx.ini
- /etc/php/7.0/cli/conf.d/20-xmlreader.ini
- /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.0/cli/conf.d/20-xsl.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.`

Fatal error: Uncaught Error: Call to undefined function oci_connect() in /var/www/html/ocitest.php:3 Stack trace: #0 {main} thrown in /var/www/html/ocitest.php on line 3

php file:

<?php

$conn = oci_connect('system', 'oracle', 'oracledb/XE');
if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} else echo 'succesful';

here is docker-compose.yml:

version: '3'

services:
   oracledb:
     image: wnameless/oracle-xe-11g
     ports:
      - "1521:1521"

   php7-with-oci8:
     depends_on:
       - oracledb
     image: adrianharabula/php7-with-oci8
     build:
        context: .
        dockerfile: ./php72/Dockerfile
     volumes:
      - ./www:/var/www/html
     ports:
      - "8181:80"

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.