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

shaddark's avatar

Laravel 9 - Error: Class "SoapClient" not found in /var/www/html/... - [apache2]

Hello i'm sure that there is a very similar topic about this problem, but i didn't find the solution.

In my laravel application i am using php soap client - on my local env i use xaamp and i already decommented the extension=soap in php.ini. The phpinfo() page says that everything is enabled. I make a soap call and everything is fine.

The trouble comes on server Ubuntu Linux 22.04 using apache2 - soap was installed and extension activated, the phpinfo page says soap is installed and enabled (same as on my local)

So even if it seems to be well configured i get this error.

The phpinfo on server says it loads the php.ini from: etc > php > 8.1 > fpm > php.ini But actually when i was enabling other extensions like oci8, ldap.. i always edited the php.ini from php > 8.1 > cli > php.ini - so basically i edit that and extensions work.

I decommented extension=soap in every php.ini of apache2, cli and fpm folders. (owner root:root mode 0644).

In my code i dispatch a job that makes a soap call and on top of the code i have:

<?php

namespace App\Jobs;

use SoapClient;
use SoapHeader;
use SoapFault;

class SendWsJde implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $timeout = 0;
    public $order_id;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($order_id)
    {
        $this->order_id = $order_id;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
		$soap_client = new SoapClient($url, $options); // THIS IS THE PART WHERE JOB FAILS ON SERVER
     }

Obviously the server was restarted many times and in every php.ini i decommented the soap extension.

Thanks for help

0 likes
1 reply
shaddark's avatar
shaddark
OP
Best Answer
Level 1

Problem solved - sys admin installed latest version of php soap and it got the 8.3 instead of 8.1

Please or to participate in this conversation.