0

Okay all you 1and1 geniuses out there. I want to make use of the Zend Soap Client ( http://framework.zend.com/manual/en/zend.soap.client.html ) on my 1and1 hosting. My hosting package is supposed to support ZF out of the box but I don't think it does. When I tried the following code

<?php
$client = new Zend_Soap_Client('/path/to/WSDL');
var_dump($client);
?>

I get an error

Fatal error: Class 'Zend_Soap_Client' not found

So I downloaded the ZF and I'm uploading it now to a folder in the root of my website. I can't seem to find any answers to what to do next. I know I need to link the ZF library folder to my include path. Can this be accomplished with .htaccess or a php.ini file? Also will I be able to use the Zend Soap Class by itself or do I have to use some other Zend Framework stuff?

Thanks.

EDIT: Strangely the include path was set properly in the root directory but not in any subdirectories. I added the include path to a new php.ini file in each subdirectory and that worked.

Devin Crossman
  • 7,454
  • 11
  • 64
  • 102
  • I didn't find much info on the 1and1 site about how to use Zend Framework, but they do say they provide it. Since the autoloader will not be set up for your scripts, try `require_once 'Zend/Soap/Client.php';` and then call `new Zend_Soap_Client()` and see what results you have. Assuming they have put ZF in the global include_path, you still have to require the file or activate the Zend Framework loader before trying to instantiate any ZF classes. – drew010 May 15 '12 at 21:10
  • This is what it says in my include path .:/usr/lib/php5:/usr/share/php/libzend-framework-php:/usr/share/zend-framework but the require_once gives me an error. Fatal error: require_once() [function.require]: Failed opening required 'Zend/Soap/Client.php' (include_path='.:/usr/lib/php5') – Devin Crossman May 15 '12 at 21:38
  • That's strange, the first include_path actually looks like it has some ZF folder in it (/usr/share/php/libzend-framework-php), but the include_path it says it is using when you called require_once only shows it looking in `.` and `/usr/lib/php5`, not in the libzend-framework-php folder. Did you get that include path from a `phpinfo()` script? – drew010 May 15 '12 at 21:46
  • Yeah i did.. I noticed that too isn't it strange? – Devin Crossman May 15 '12 at 21:56
  • I created a php.ini file with the include path set there but that didn't work and when I tried to set the include path with the .htaccess file I got a 500 Server Error – Devin Crossman May 15 '12 at 21:57
  • Is PHP running as an Apache module or a CGI? If it is *not* a module, then trying to use htaccess to set php directives will result in a server error. The php.ini method works in some CGI situations. `phpinfo()` will tell you what `php.ini` file is being used, and any additional `php.ini` files that it has processed. Yeah I am a bit confused as to the difference between what you saw with include_path and what require_once is using... – drew010 May 15 '12 at 22:14
  • One often runs into this error, and to quickly troubleshoot it, follow these steps : https://stackoverflow.com/a/36577021/2873507 – Vic Seedoubleyew Apr 12 '16 at 15:29

2 Answers2

1

Add

require_once 'Zend/Loader/Autoloader.php';

to the beginning of the script.

If it doesn't work, check include path in the script - it should contain libzend-framework-php directory with

<?php
echo get_include_path();

If it doesn't you can either report it to 1and 1 or set it manually in the beginning of the script

<?php
set_include_path(get_include_path() . PATH_SEPARATOR . "directory with zend framework");
jacekll
  • 337
  • 2
  • 7
0

The first thing you should to is set the include path in the php.ini folder, or do a phpinfo() to get the current include path. then put the zend lib in that path. finally just require the Client.php script inside the Zend/Soap folder.

mpm
  • 20,148
  • 7
  • 50
  • 55