SoapClient (hosting)

Uit De Vliegende Brigade
Ga naar: navigatie, zoeken

Foutmelding

Fatal error: Class 'SoapClient' not found in /var/www/example.com/sites/all/modules/commerce_buckaroo/api/soap.php on line 327

Aanvullende gegevens

  • Dit was in februari 2017 op een redelijk-vers-geïnstalleerde interne ontwikkelserver, dus het is goed mogelijk dat van alles en nog wat ontbreekt.
  • phpinfo() vermelde geen hoofdstuk SOAP, dus ik denk dat de betreffende bibliotheek gewoon niet is geínstalleerd [1]

Installatie SOAP

Een bron suggereert

sudo apt-get install php7.0-soap

maar ik heb liever de php7.1-variant, indien mogelijk. Geen probleem, want het commando werkt ook zonder de '7.0'-toevoeging:

PHP 7.1

sudo apt-get install php-soap

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  php7.1-bcmath php7.1-cli php7.1-common php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-opcache
  php7.1-readline php7.1-soap php7.1-xml
The following NEW packages will be installed:
  php-soap php7.1-soap
The following packages will be upgraded:
  php7.1-bcmath php7.1-cli php7.1-common php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-opcache
  php7.1-readline php7.1-xml
10 upgraded, 2 newly installed, 0 to remove and 241 not upgraded.
Need to get 3,225 kB of archives.
After this operation, 351 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Dit is de rest van de output. Ik geloof dat ik al eerder een PPA had toegevoegd:

Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-gd amd64 7.1.2-3+deb.sury.org~xenial+1 [27.2 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-opcache amd64 7.1.2-3+deb.sury.org~xenial+1 [141 kB]
Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-json amd64 7.1.2-3+deb.sury.org~xenial+1 [17.2 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-readline amd64 7.1.2-3+deb.sury.org~xenial+1 [12.8 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-cli amd64 7.1.2-3+deb.sury.org~xenial+1 [1,326 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-xml amd64 7.1.2-3+deb.sury.org~xenial+1 [113 kB]
Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-bcmath amd64 7.1.2-3+deb.sury.org~xenial+1 [15.6 kB]
Get:8 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-mbstring amd64 7.1.2-3+deb.sury.org~xenial+1 [465 kB]
Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-mysql amd64 7.1.2-3+deb.sury.org~xenial+1 [120 kB]
Get:10 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-common amd64 7.1.2-3+deb.sury.org~xenial+1 [868 kB]
Get:11 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php7.1-soap amd64 7.1.2-3+deb.sury.org~xenial+1 [113 kB]
Get:12 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 php-soap all 1:7.1+49+deb.sury.org~xenial+4 [5,128 B]
Fetched 3,225 kB in 0s (12.5 MB/s)    
(Reading database ... 211325 files and directories currently installed.)
Preparing to unpack .../php7.1-gd_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-gd (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-opcache_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-opcache (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-json_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-json (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-readline_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-readline (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-cli_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-cli (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-xml_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-xml (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-bcmath_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-bcmath (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-mbstring_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-mbstring (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-mysql_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-mysql (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Preparing to unpack .../php7.1-common_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-common (7.1.2-3+deb.sury.org~xenial+1) over (7.1.2-2+deb.sury.org~xenial+1) ...
Selecting previously unselected package php7.1-soap.
Preparing to unpack .../php7.1-soap_7.1.2-3+deb.sury.org~xenial+1_amd64.deb ...
Unpacking php7.1-soap (7.1.2-3+deb.sury.org~xenial+1) ...
Selecting previously unselected package php-soap.
Preparing to unpack .../php-soap_1%3a7.1+49+deb.sury.org~xenial+4_all.deb ...
Unpacking php-soap (1:7.1+49+deb.sury.org~xenial+4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up php7.1-common (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-gd (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-opcache (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-json (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-readline (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-cli (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-xml (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-bcmath (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-mbstring (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-mysql (7.1.2-3+deb.sury.org~xenial+1) ...
Setting up php7.1-soap (7.1.2-3+deb.sury.org~xenial+1) ...

Creating config file /etc/php/7.1/mods-available/soap.ini with new version
Setting up php-soap (1:7.1+49+deb.sury.org~xenial+4) ...

sudo service apache2 restart

... Werkte niet. Het verscheen ook niet via phpinfo(). Vermoedelijke oorzaak: Ik gebruik toch écht PHP 7.0 (bron: phpinfo()) →

PHP 7.0

sudo apt-get install php7.0-soap
sudo service apache2 restart

→ Probleem opgelost. Ik heb de php 7.1-bibliotheek laten staan: Het zit niet in de weg.

Bronnen