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

Add support for oci8 and pdo_oci extensions no longer bundled with PHP #894

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

mlocati
Copy link
Owner

@mlocati mlocati commented Mar 1, 2024

@mlocati mlocati added the waiting for external maintainer We are waiting for the maintainer of a 3rd party tool label Mar 1, 2024
@mvorisek
Copy link
Contributor

mvorisek commented Mar 15, 2024

Hi @mlocati, I have merged php/pecl-database-pdo_oci#1 and tested this PR with ghcr.io/mvorisek/image-php:8.4-debian-base image (as discussed in #892 (comment)).

prepare commands:

apt update && apt install git
git clone https://github.com/mlocati/docker-php-extension-installer.git -b oci-php8.4
chmod +x docker-php-extension-installer/install-php-extensions

I was able to run docker-php-extension-installer/install-php-extensions oci8

but

docker-php-extension-installer/install-php-extensions pdo_oci failed with:

Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [12.7 kB]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [146 kB]
Fetched 9200 kB in 2s (6032 kB/s)
Reading package lists...
### MARKING PRE-INSTALLED PACKAGES AS IN-USE ###
libaio1 was already set to manually installed.
### INSTALLING REQUIRED PACKAGES ###
# Packages to be kept after installation:
# Packages to be used only for installation: unzip
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package unzip.
(Reading database ... 14780 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-28_amd64.deb ...
Unpacking unzip (6.0-28) ...
Setting up unzip (6.0-28) ...
### INSTALLING REMOTE MODULE pdo_oci ###
WARNING: "pear/PDO_OCI" is deprecated in favor of "channel://http://www.php.net/pdo_oci/ext/pdo_oci"
pear/PDO_OCI requires PHP (version >= 5.0.3, version <= 6.0.0), installed version is 8.4.0-dev
No valid packages found
install failed

that is probably expected as this installed install stable/released packages.

However, when I run docker-php-extension-installer/install-php-extensions php/pecl-database-pdo_oci@a2106eb7fe I get the following error:

Downloading source from https://codeload.github.com/php/pecl-database-pdo_oci/tar.gz/a2106eb7fe
Checking package.xml of directory /tmp/src/tmp.8zY6TDImtN/pecl-database-pdo_oci-a2106eb7fe... good (name: pdo_oci, version: 1.1.0)
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists...
### MARKING PRE-INSTALLED PACKAGES AS IN-USE ###
libaio1 was already set to manually installed.
### INSTALLING REMOTE MODULE pdo_oci ###
  (installing version 1.1.0 from /tmp/src/tmp.8zY6TDImtN/pecl-database-pdo_oci-a2106eb7fe)
7 source files, building
running: phpize
Configuring for:
PHP Version:             8.4
PHP Api Version:         20230901
Zend Module Api No:      20230901
Zend Extension Api No:   420230901
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : building in /tmp/pear/temp/pear-build-defaultuserxgm2hC/pdo_oci-1.1.0
running: /tmp/pear/temp/pdo_oci/configure --with-php-config=/usr/local/bin/php-config --with-pdo-oci=instantclient,/usr/lib/oracle/21.1/client64/lib
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
...
checking size of long... 8
checking if we're at 64-bit platform... yes
checking Oracle version... 21.1
checking for oci.h... configure: error: I'm too dumb to figure out where the include dir is in your Instant Client install
ERROR: `/tmp/pear/temp/pdo_oci/configure --with-php-config=/usr/local/bin/php-config --with-pdo-oci=instantclient,/usr/lib/oracle/21.1/client64/lib' failed

This should be probably fixed before this PR is merged. Should it be fixed here or in the https://github.com/php/pecl-database-pdo_oci repo?

@mlocati
Copy link
Owner Author

mlocati commented Mar 15, 2024

Should it be fixed here or in the https://github.com/php/pecl-database-pdo_oci repo?

I don't know: install-php-extensions should pass the with-pdo-oci option to pecl (exaclly like it passes the with-oci8 option for oci8)

@mvorisek
Copy link
Contributor

It seems https://github.com/php/pecl-database-oci8/blob/main/config.m4 is working. I tried diffing it with https://github.com/php/pecl-database-pdo_oci/blob/main/config.m4, the diff is non-trivial, but the OCI8 can be probably used as a working reference. My question is however why the pdo_oci install was working before the unbundling, did anything changed?

@mlocati
Copy link
Owner Author

mlocati commented Mar 18, 2024

I've tried running this code in two docker containers (launched with docker run --rm -it php:8.3-cli bash and docker run --rm -it ghcr.io/mvorisek/image-php:8.4-debian-base bash):

cd /tmp

# Download and extract the oci-php8.4 branch of https://github.com/mlocati/docker-php-extension-installer
curl -sSLf -o- https://github.com/mlocati/docker-php-extension-installer/archive/refs/heads/oci-php8.4.tar.gz | tar xz

# Download and extract the main branch of https://github.com/php/pecl-database-pdo_oci
curl -sSLf -o- https://github.com/php/pecl-database-pdo_oci/archive/refs/heads/main.tar.gz | tar xz

CI=true /tmp/docker-php-extension-installer-oci-php8.4/install-php-extensions /tmp/pecl-database-pdo_oci-main

With the official PHP 8.3 docker image everything works just fine
With your PHP 8.4 docker image I have this error:

cc -I. -I/tmp/pear/temp/pdo_oci -I/tmp/pear/temp/pear-build-defaultuserYKZKBo/pdo_oci-1.1.0/main -I/tmp/pear/temp/pdo_oci -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/lib/oracle/21.1/client64/lib/sdk/include -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -I/usr/local/include/php/ext -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/pdo_oci/pdo_oci.c -MMD -MF pdo_oci.dep -MT pdo_oci.lo  -fPIC -DPIC -o .libs/pdo_oci.o
/tmp/pear/temp/pdo_oci/oci_statement.c: In function 'oci_stmt_fetch':
/tmp/pear/temp/pdo_oci/oci_statement.c:466:9: error: 'S' undeclared (first use in this function)
  466 |         S->last_err = OCIStmtFetch2(S->stmt, S->err, 1, ociori, (sb4) offset, OCI_DEFAULT);
      |         ^
/tmp/pear/temp/pdo_oci/oci_statement.c:466:9: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:217: oci_statement.lo] Error 1

I'm sorry I can't help you more (I'm not an expert of OCI).

@mvorisek
Copy link
Contributor

mvorisek commented Mar 18, 2024

Thank you for beiing so patient with me.

In php/pecl-database-pdo_oci#1 I did a mistake. Now I fixed it in php/pecl-database-pdo_oci@be8a277.

So I can confirm this PR is working. Once again, thank you!

One small question to #892 - is anything like done in this PR needed also for unbundled imap ext?

@mlocati mlocati merged commit 0609246 into master Mar 18, 2024
39 checks passed
@mlocati mlocati deleted the oci-php8.4 branch March 18, 2024 15:55
@mlocati
Copy link
Owner Author

mlocati commented Mar 18, 2024

is anything like done in this PR needed also for unbundled imap ext?

Yep.

Just to summarize the list of PHP extensions removed from the PHP main repository:

Am I missing some?

@mvorisek
Copy link
Contributor

only these 4 were unbundled - https://wiki.php.net/rfc/unbundle_imap_pspell_oci8

@mlocati
Copy link
Owner Author

mlocati commented Mar 18, 2024

is anything like done in this PR needed also for unbundled imap ext?

➡️ #900

only these 4 were unbundled

Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for external maintainer We are waiting for the maintainer of a 3rd party tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

oci8/pdo_oci (and imap) have been moved to PECL
2 participants