As I am looking into Apex (again), here you can find a movie app built with Apex 20.2
just for fun, it contains information about approximately 85000 movies (from IMDb / Kaggle
The app pretends nothing. Just a study.
You can enter it with credentials demo / Verw8ting
- changes are recorded regarding adding, modifying records. But are lost as with deletion.
Bit more about PHP>
Also fond of PHP?
It was quit a challenge to get this going. Below the steps taken are written down.
But first, some information about numbers in the MovieApp database, queried from the Oracle database, with PHP :-)
As for now, 21/05/2022 20:55, we have these numbers in the database:
Technical background of the installation.
The infrastructure configuration is as follows, hosted at cloud.oracle.com
- Oracle database Version 19c
- Linux Ubuntu 20.04
- PHP 8.0
- Apache 2
- Oracle Instant Client 21.1
Let's not pretend it was easy. But finally we found a way to get it on.
Looking at the list and image above, you got the feeling, it was a long walk.
The bottomline was: get Oracle client software in a place the webserver can reach it,
and get PHP ready with the OCI8 module to communicate with the Oracle Client software.
So, what all happened (sudo where necessary):
- PHP 8.0
Add the repository with PHP8, it is not default in Ubuntu 20.04
$ sudo apt install software-properties-common
We install php8.0 together with Apache webserver.
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
We choose for FPM, the Fast CGI Process Manager for PHP:
$ sudo apt install php8.0 libapache2-mod-php8.0
$ sudo apt update
$ udo apt install php8.0-fpm libapache2-mod-fcgid
$ systemctl restart apache2
- Oracle Instantclient
url: https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html (for linux)
Download the basic and the tools, f.e.:
Upload these zip-files to the Ubuntu server.
Create a directory for the files:
$ mkdir /opt/oracle
Put the zip files in /opt/oracle and unzip them.
$ unzip instantclient-basic-linux.x64-22.214.171.124.0.zip
For ease of reading we moved instantclient_21_1 to instantclient.
$ unzip instantclient-tools-linux.x64-126.96.36.199.0.zip
Check that symlinks are present for libclntsh.so and libocci.so. Otherwise create them, like:
$ ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
Add the Oracle Instantclient folder to ldconfig:
$ ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so
$ echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient
And load it:
Give the Apache webserver access to it:
$ sudo chown -R root:www-data /opt/oracle
We need more PHP files to proceed with OCI8:
$ apt-get install php-dev php-pear build-essential libaio1
Update the pecl channel:
$ pecl channel-update pecl.php.net
Here it comes, finally:
$ pecl install oci8
Once asked, enter:
Then, glueing it all together, tell PHP to load the OCI8 extension and Apache where to look.
Find the php.ini files, like
$ find / -name php.ini
Edit them, add the OCI8 extension: extension=oci8.so
$ sudo vi /etc/php/8.0/fpm/php.ini
We need to set environment variables, like TNS_ADMIN, ORACLE_HOME, and PATH.
$ sudo vi /etc/php/8.0/apache2/php.ini
$ sudo vi /etc/php/8.0/cli/php.ini
$ export ORACLE_HOME=/opt/oracle/instantclient
You would probably look for that in /etc/environment and/or in .bashrc or .bash_profile.
$ export PATH=$PATH:/opt/oracle/instantclient
$ export TNS_ADMIN=/opt/oracle/instantclient/network/admin
Apache: edit the following with vi, vim or nano directly, or try with the following echo's:
$ echo "export LD_LIBRARY_PATH=/opt/oracle/instantclient" >> /etc/apache2/envvars
$ echo "export ORACLE_HOME=/opt/oracle/instantclient" >> /etc/apache2/envvars
$ echo "LD_LIBRARY_PATH=/opt/oracle/instantclient:$LD_LIBRARY_PATH" >> /etc/environment
Don't forget to edit sqlnet.ora and tns_names in /opt/oracle/instantclient/network/admin
Restarting the server now is not such a bad idea.
Then, after the server is up again, check and go!
The following should give a reply.
$ php -m | grep 'oci8'
(in case of problems, you could check /etc/php/8.0/fpm/conf.d and mods_available.)
Restart the PHP Fast Process Manager
$ service php8.0-fpm restart
- Check with info.php page, like
Part of info.php:
... and relax, you can breath again