I am new to PHP, so I apologize for my inexperience. I am working in a Windows 10 environment and have installed WAMP to serve Apache, PHP, and MySQL. I am creating some remoteObject webservices for an Adobe AIR app that will communicate with Zend using AMF, and I have created an index.php file to get everything in motion, but when I browse to the index.php file, I get all kinds of errors. Here is the index.php file:
index.php
<?php
require_once('Zend/Amf/Server.php');
require_once('HalfService.php');
$server = new Zend_Amf_Server();
//adding our class to Zend AMF Server
$server->setClass("HalfService");
//Mapping the ActionScript VO to the PHP VO
//you don't have to add the package name
$server->setClassMap("VOService", "VOService");
echo($server -> handle());
?>
My File structure is:
C:/wamp64/www/
ZendFramework/library/Zend/Amf/Server.php
zendamf_remote/index.php
HalfService.php
VOService.php
I tried to create a include_path in my php.ini file that looks like this, but it did not work:
include_path = “c:\wamp64\www\ZendFramework\library”
Finally, this is the error that I get when I browse to index.php in a browser:
( ! ) Warning: require_once(Zend/Amf/Server.php): failed to open stream: No such file or directory in C:\wamp64\www\zendamf_remote\index.php on line 2
( ! ) Fatal error: require_once(): Failed opening required 'Zend/Amf/Server.php' (include_path='�c:\wamp64\www\ZendFramework\library�') in C:\wamp64\www\zendamf_remote\index.php on line 2
Any help at all in getting this configured would really be appreciated. Thanks so much!
"In your question you appear to have smart quotes around the path, so that may be it. See if changing that helps. – Tim Fountain"
Thanks to Tim Fountain for answering this question, who noticed something I wouldn't have seen in a million years
Related
if i try the following command:
$_content = file_get_contents("ssh2.sftp://".intval($sftp)."/Lorem-62398848890105_20190117-101229.txt");
it works and i get the correct content.
But whenever I want to have all the files of the remote folder, the directory can not be opened.
I tried scandir or opendir. Both of these raises this message:
Warning: scandir(): Unable to open ssh2.sftp://12/ on remote host
What im doing wrong? Some tips would really help me.
Regards
Context: I use PHP 7.0.32 and ssh2.so is fully installed
UPDATE: I got it. I think it is due to a wrong attitude of the provider.
How it works:
$handle = opendir("ssh2.sftp://".intval($sftp).ssh2_sftp_realpath($sftp,".").'./');
The function ssh2_sftp_realpath + './' do the trick.
I am trying to set up server side script code for DataTables. What I have done so far :
Downloaded SSP from package
Installed PEARL on PHP server
Changed PHP.INI file include_path to the pearl folder
Placed the SSP class inside the same folder.
I keep getting the error message :
PHP Fatal error: require(): Failed opening required
'\crm\maintenance\ssp.class.php' (include_path='C:\Program Files
(x86)\php\v5.3\pear\') in C:\IIS\CRM\maintenance\khalid.php
Thhis is how i am calling the ssp class
require( 'ssp.class.php' );
SOME ADVICE!
The above steps WORK. In editing the question I had noticed that i was trying to specify a path in statement below as such :
require( '\xxx\xxxssp.class.php' ); // this does not work
FOLLOW the steps as outline the question itself and it will work!
I am trying to generate a WSDL for a working Soap web service using the following PHP code (the code is running in Xampp on Windows 7):
<?php
include('Zend/Soap/AutoDiscover');
$autodiscover = new Zend_Soap_AutoDiscover();
$autodiscover->setClass('MyService')
->setUri('http://localhost/Public_Web_Service')
->setLocation('http://localhost/Public_Web_Service/server.php')
->setServiceName('MyService');
$wsdl = $autodiscover->generate();
$wsdl->dump("C:/xampp/htdocs/file.wsdl");
?>
However, when I run the code, I run into the following error message:
Warning: include(C:\xampp\php\pear\Zend\Soap\AutoDiscover): failed to open stream: Permission denied in C:\xampp\htdocs\Public_Web_Service\zend-wsdl.php on line 2
Warning: include(): Failed opening 'Zend/Soap/AutoDiscover' for inclusion (include_path='.;C:\xampp\php\PEAR;c:\xampp\php\PEAR\Zend') in C:\xampp\htdocs\Public_Web_Service\zend-wsdl.php on line 2
Fatal error: Class 'Zend_Soap_AutoDiscover' not found in C:\xampp\htdocs\Public_Web_Service\zend-wsdl.php on line 3
I am very new to Zend and my main focus is on creating Soap web services in PHP.
Any help would be greatly appreciated.
Thanks,
John Cleaver
Change:
include('Zend/Soap/AutoDiscover");
To:
include('Zend/Soap/AutoDiscover.php");
include() looks for a physical file on your server - so the file part needs to reflect the exact file name.
You're working with Zend Framework 1 it looks like. In your application you could use something like this in your bootstrap (startup) scripts:
function myAutoload($className)
{
$classArray = explode("_", $className);
foreach ($classArray as $key => $value) {
$classArray[$key] = ucfirst($value);
}
$className = implode('/', $classArray);
require_once($className . ".php");
}
spl_autoload_register("myAutoload");
Then you never need to include() anything - it just automatically loads. But please note that this is legacy functionality. Zend Framework 2 as well as other modern frameworks do not use this feature for a reason. I'm still a big fan of Zend Framework 1 because of its user friendliness - something that most modern frameworks lack. If you want to keep using Zend Framework 1, the above snippet can save you a lot of time.
I've spent a lot of time troubleshooting this myself but none of what I've read solves my issue so I'm hoping I get some help here.
So anyway, I have written a PHP script that provides various functions to connect with Google Calendar. When I run this script directly using some inline test code to call my functions, everything runs fine. However, when I call the function from other scripts using 'require_once' to include it I get the following errors:
Warning: include_once(Zend\Gdata\Calendar\Extension\EventQuery.php) [function.include-once]: failed to open stream: No such file or directory in C:\Users\Luke Franklin\Clients\Tiers For Tea\Development\TiersForTea.com v1.1\lib\Zend\Loader.php on line 134
Warning: include_once() [function.include]: Failed opening 'Zend\Gdata\Calendar\Extension\EventQuery.php' for inclusion (include_path='.;C:\xampp\php\PEAR;C:\Users\Luke Franklin\Clients\Tiers For Tea\Development\TiersForTea.com v1.1\lib;C:\xampp\htdocs\TiersForTea.com\lib') in C:\Users\Luke Franklin\Clients\Tiers For Tea\Development\TiersForTea.com v1.1\lib\Zend\Loader.php on line 134
Your first thoughts might be that I'm not using the correct include path, but I have checked and rechecked this many times. I even tried hard coding the path. I'm quite sure that I'm using the correct path.
Now for the weird bit. If you look at the error you will notice the file Zend is trying to include: Zend\Gdata\Calendar\Extension\EventQuery.php. This file does not actually exist in the 'Extension' folder. It does exist in the parent folder though. If I just copy 'EventQuery.php' into the 'Extension' folder my script runs as expected. Weird, right?
So that does sorta solve my problem, but I would like to know what's going on here in-case it creates further issues. I should also note that I'm calling this script into an OpenCart module.
You might want to see some of my code so here's a snippet of the important bits, if you want more details just let me know:
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . realpath('\\lib') . PATH_SEPARATOR . "C:\\xampp\\htdocs\\TiersForTea.com\\lib");
require_once('Zend/Loader.php');
function connect() {
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
I doubt the error exists in any of the Zend files as you have indicated it works correctly in your isolation tests.
The error is thrown from Zend_Loader which means something in your code is making reference to Zend_Gdata_Calendar_Extension_EventQuery.
Check the stack trace for the error if available to pinpoint the location. If that's not available, do a global find for that string. If you find any matches, you will need to change them to Zend_Gdata_Calendar_EventQuery.
Update
Seems this is a known bug(s)
http://framework.zend.com/issues/browse/ZF-7013
http://framework.zend.com/issues/browse/ZF-11959
It's an issue when your code registers an error handler using ErrorException. Apparently it's fixed in the 1.12 branch but hasn't made it to a release yet.
There's a patch in the 11959 bug report that fixes the issue
I've inherited a site from a developer and they're using the following function to set the document root and define the mysql_connection for the site I assume:
function construct()
{
$this->mysql_link = mysql_connect("the_host", "username", "password");
mysql_select_db("thedatabase", $this->mysql_link);
$this->rootDir = $_SERVER['DOCUMENT_ROOT']."admin/";
$this->templateDir = $this->rootDir."templates/";
$this->isAdmin();
}
The trouble is, when I try to run this on my local development platform (Mac OSX Lion/PHP/Mysql) I keep getting the following error:
Warning: include(/Library/WebServer/Documentsadmin/templates/index/In The News/item.php) [function.include]: failed to open stream: No such file or directory in /Users/mycomputername/Sites/thewebsite.com/admin/editable.class.php on line 283
I'm relatively new to PHP and I'm assuming there's a problem with my php.ini file pointing to the wrong place as the web root but I'm not sure how to fix that or if that's even the problem I'm experiencing.
The database connection is functioning properly though.
Any help in diagnosing this is greatly appreciated.
Why not set rootDir to
$this->rootDir = dirname(__FILE__)."/admin";
instead? (add some more dirname()s around it if you need a higher level).
Assuming of course that the rootDir you need is somehow related to this file.