I'm trying to upgrade the charts in my zend framework based website to the open flash chart 2 (version: kvasir) library. It used to work just fine with older versions. However, using the new version, when I try to create e.g. lines, I get error messages such as
Warning: include(line\hollow.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\weMatch\library\Zend\Loader.php on line 83
Fatal error: Class 'line_hollow' not found in C:\xampp\htdocs\weMatch\application\default\controllers\FeedbackController.php on line 215
I suspect that the Zend_Loader_Autoloader is replacing the underscore with a backslash. Can I exclude the whole open flash chart library from the Zend_Loader_Autoloader?
It is changing the _ to /. You could just include the file yourself beforehand.
require_once('path/to/line_hollow.php'); or whatever the filename is.
I found out that the API of the open flash library has changed with the new version (kvasir). As in old versions, there's a file you need to include which includes all the other library classes (open-flash-chart.php). I saw that the class line_hollow.php was commented out in this file and I therefore guess it's deprecated. When I tried to include line_hollow.php, there were some follow up errors. Luckily, there are other ways to achieve the same result. Instead of:
$line = new line_hollow();
you go
$line= new line();
$dot = new hollow_dot();
$line->set_default_dot_style($dotTeam);
The latter way gives you more flexibility, because you can give the $dot additional attributes.
Related
I am playing around with parsing spreadsheets and found the spreadsheet-reader class. I installed and have a very simple program written to open and parse an ".ODS" spreadsheet file. When I run it I get the error:
PHP Fatal error: Class 'XMLReader' not found in...
The line in question:
$ss = new SpreadsheetReader("test.ods");
So I google around and find out the version of PHP on that system needs to be at least 5.1 for it to use the version of XMLReader built into the core of PHP. I am using 5.4.12 there. I check with php -i and find PHP was compiled with: '--enable-xmlreader=shared'. According to the docs nothing needs to be configured at runtime to enable it.
Where else can I check and what am I doing wrong?
The solution is because PHP was built with a shared object file you DO need to modify php.ini: extension=xmlreader.so.
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 am trying to run basic example of phpExcel in symfony1.4 and i am getting this error
C:\wamp\www\orangehrm-3.01\symfony>php plugins/sfPhpExcelPlugin/examples_1_2/01s
imple.php
10:39:01 Create new PHPExcel object
PHP Fatal error: Class 'sfConfig' not found in C:\wamp\www\orangehrm-3.01\symfo
ny\plugins\sfPhpExcelPlugin\lib\sfPhpExcel.class.php on line 9
any idea will be approciate.
The code for this plugin's examples is a bit strange. It uses the sfConfig class to read Symfony config variables but doesn't initialize nor include any Symfony code (hence the error).
In fact when you look at the code of this plugin you'll see that all it does is set some configuration when instantiating PHPExcel object. I would skip the plugin altogether and just use the PHPExcel directly in your project (you can either include it in the controller where you use it or in the ProjectConfiguration.class.php to make it available for the whole project (not recommended though).
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
A big beginner of Zend-framework on PHP calls, I could include it on Netbeans IDE. Now I'm trying to use it to achieve a Lucene indexer and searcher using Zend_Lucene, I followed the getting started of the official site, unfortunately they explain the whole thing with just few words. Anyway, I copied pasted this $index = Zend_Search_Lucene::create($indexPath);, but I got a message onto this line saying: Fatal error: Class 'Zend_Search_Lucene' not found in C:\wamp\www\witswork\luceneTry.php
means that the function still unknown, maybe, some files need to be copied on my project folder but really I'm running out of ideas right now.
Accept my regards,
dany90.
You need to load the php file which contains the Zend_Search_Lucene class first. One option is to load your/path/to/library/Zend/Search/Lucene.php:
require_once 'my/path/to/library/Zend/Search/Lucene.php';
$index = new Zend_Search_Lucene::create($indexPath);
This class loads all its dependencies, so you don't need to worry about that.
Another option is to use the autoloader of Zend, Zend_Loader_Autoloader. This class is a singleton and registers itself with spl_autoload() when you retrieve it for the first time:
$autoloader = Zend_Loader_Autoloader::getInstance();
$index = new Zend_Search_Lucene::create($indexPath);
After the autoloader is loaded, you just can use Zend_Search_Lucene without the require_once() call. In the manual of Zend Framework you can find more information about the autoloader.