Skip to content

Commit c65dea5

Browse files
committed
feat: add oci8 support to shallow server
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
1 parent b1197b9 commit c65dea5

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

shallow-server/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ RUN apt-get update && \
1313
php-dompdf php8.1-apcu redis-server php8.1-redis php8.1-smbclient \
1414
php8.1-ldap unzip php8.1-pgsql php8.1-sqlite make apache2 \
1515
php8.1-opcache libmagickcore-6.q16-2-extra \
16-
libapache2-mod-php8.1 && \
16+
libapache2-mod-php8.1 php-pear libaio1 build-essential expect && \
1717
apt-get autoremove -y && apt-get autoclean && apt-get clean && \
1818
rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*
1919

20-
COPY opcache-recommended.ini /etc/php/8.1/cli/conf.d/99-opcache-recommended.ini
20+
# Oracle setup
21+
COPY oci8-setup.sh /tmp/oci8-setup.sh
22+
RUN chmod +x /tmp/oci8-setup.sh && \
23+
/tmp/oci8-setup.sh && \
24+
rm -f /tmp/oci8-setup.sh
25+
2126
COPY apc-cli-enable.ini /etc/php/8.1/cli/conf.d/99-apc-cli-enable.ini
27+
COPY oci8-enable.ini /etc/php/8.1/apache2/conf.d/99-oci8-enable.ini
28+
COPY opcache-recommended.ini /etc/php/8.1/cli/conf.d/99-opcache-recommended.ini
2229

2330
WORKDIR /var/www/html
2431

shallow-server/oci8-enable.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=oci8.so

shallow-server/oci8-setup.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status.
4+
set -e
5+
6+
ORACLE_DIR="/opt/oracle/instantclient"
7+
8+
# Remove existing files if they exist
9+
[ -f "instantclient-basic-linuxx64.zip" ] && rm "instantclient-basic-linuxx64.zip"
10+
[ -f "instantclient-sdk-linuxx64.zip" ] && rm "instantclient-sdk-linuxx64.zip"
11+
12+
# Download Oracle Instant Client basic package
13+
curl -kL "https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip" > "instantclient-basic-linuxx64.zip"
14+
15+
# Download Oracle Instant Client SDK package
16+
curl -kL "https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip" > "instantclient-sdk-linuxx64.zip"
17+
18+
# Unzip the downloaded files
19+
echo "Unzipping downloaded files..."
20+
unzip -o instantclient-basic-linuxx64.zip
21+
unzip -o instantclient-sdk-linuxx64.zip
22+
23+
# Create Oracle directory
24+
echo "Creating Oracle directory..."
25+
mkdir -p $ORACLE_DIR
26+
27+
# Move Instant Client to the Oracle directory
28+
echo "Moving Instant Client to the Oracle directory..."
29+
mv instantclient*/* $ORACLE_DIR
30+
ls -la $ORACLE_DIR
31+
32+
# Create symbolic links
33+
echo "Creating symbolic links..."
34+
ln -sf $ORACLE_DIR/libclntsh.so.12.1 $ORACLE_DIR/libclntsh.so
35+
ln -sf $ORACLE_DIR/libocci.so.12.1 $ORACLE_DIR/libocci.so
36+
37+
# Configure dynamic linker run-time bindings
38+
echo "Configuring dynamic linker run-time bindings..."
39+
echo $ORACLE_DIR | tee /etc/ld.so.conf.d/oracle-instantclient.conf
40+
ldconfig
41+
42+
# Install OCI8 for PHP 8.2
43+
echo "Installing OCI8 extension for PHP 8.2..."
44+
/usr/bin/expect <<EOF
45+
set timeout 60
46+
spawn pecl install oci8-3.2.1
47+
expect "Please provide the path to the ORACLE_HOME directory"
48+
send "instantclient,/opt/oracle/instantclient\r"
49+
expect eof
50+
EOF
51+
52+
echo "Oracle Instant Client and OCI8 installation completed."

0 commit comments

Comments
 (0)