Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

krie9er's avatar

Configure Oracle database in Laravel

Hey i'm not sure if im right in the forum,

but i have a short Question

i want to use the oci-pdo driver, so could i just extend the config/database.php?

or is there any other way to use an oracle DB?

0 likes
7 replies
krie9er's avatar

Oh thanks :-)

I'll try it, the installation was quite simple :-)

krie9er's avatar

Hey sorry but i have to relive this thread.

I've implemented the oci Extension, and i can connect to the database.

but i can't do anything with the database :-(

on every query i get table or view not found.

I did the following

php artisan tinker
>>> $test = app\test->where('status', 110)->Count();

and get the ORA-00942 Error.

I wrote the same statement inside the sqlDevelopper:

SELECT COUNT(*) from tests where status = 110;

And get a result.

My databasefile contains:

'oracle' => array(
        'driver' => 'oracle',
    'host' => 'localhost',
        'port' => '1521',
        'database' => 'xe',
        'username' => 'user',
        'password' => 'pass',
        'charset' => 'AL32UTF8',
        'prefix' => '',
)

i've tried to write a quick test to proof that it isn't a laravel Problem in php:

<?php
    $conn = oci_connect("user", "pass", "localhost/xe");
    $stdi = oci_parse($conn, "SELECT COUNT(*) FROM tests WHERE STATUS =110");
    echo oci_execute($stdi);

it seems like i have the wrong "database" but as i know oralce doesn't work with seperate databases like MySQL.

I run Oracle Express 11.

Thanks

krie9er's avatar

Problem is solved,

got the wrong user :-(

Sorry

1 like
tuvshintugs's avatar

Hi I have problem, i want to connect oracle database on laravel. i wrote run composer require yajra/laravel-oci8:"5.8.*" wampserver : 3.1.9 php: 7.2.18

Error : the requested php extention oci8 is missing from your system

How to configure this case?

Please or to participate in this conversation.