I'm running out of ideas here. Physically, my Zend install (XAMPP on Windows) is located at D:\xampp\htdocs\newsite\zend\library.
So far, I've managed to fail with all of the following include paths, as reported in zend.php (located at D:\xampp\htdocs\newsite and accessed from 127.0.0.1/newsite/zend.php.
.;D:\xampp\php\PEAR
.;D:\xampp\php\PEAR;/zend/library
.;D:\xampp\php\PEAR;D:\xampp\htdocs\newsite\zend\library
.;D:\xampp\php\PEAR;D:/xampp/htdocs/newsite/zend/library
.;D:/xampp/htdocs/newsite/zend/library
.;D:\xampp\htdocs\newsite\zend\library
D:\xampp\htdocs\newsite\zend\library
.;./zend/library;D:\xampp\php\PEAR;D:\xampp\htdocs\newsite\zend\library
.;./zend/library;D:\xampp\php\PEAR;D:\xampp\htdocs\newsite\zend\library;/zend/library
.;./zend/library;D:\xampp\php\PEAR;D:\xampp\htdocs\newsite\zend\library;D:/xampp/htdocs/newsite/zend/library
EDIT: Yes, I got all of the above through get_include_path(). I'm on PHP 5.3.8.
Assuming you are not trying to use auto loading, which would be a good idea to rule out problems with auto loaders.
Since the include_path returns ".;D:\xampp\php\PEAR;D:\xampp\htdocs\newsite\zend\library" I would expect a simple include to work.
Assuming you are using ZF2, this test should not error, if the above include path is being returned:
<?php
include ('Zend\Version\Version.php');
If that does error, try it with a full path to verify if it's the include path or something else that is causing the file not to be included.
<?php
include ('D:\xampp\htdocs\newsite\zend\library\Zend\Version\Version.php');
If your test is more complicated that the above, maybe it's something other than the include path going wrong. Can you post the code that is failing?
Also, you might consider installing the ZF2 Skeleton App, which shows current best practices for setting up autoloading, namespaces, etc.
https://github.com/zendframework/ZendSkeletonApplication
While using Zend Library, make sure
1) You have parent dir of Zend folder in include paths
D:\xampp\htdocs\newsite\zend\library has to be in include paths, not D:\xampp\htdocs\newsite\zend\library\Zend
2) PHP not running in safe mode, also PHP is updated to 5.2+ or 5.3+ and if apc is turned on, it must have apc.include_once_override off.
If still not working, inspect by printing get_include_path() or phpinfo();
That should be it.
Related
I recently downloaded the full package version(recommended) of ZendFramework(2.0.5).And tried and failed to install in xampp(version 1.7.4) also my php version is 5.3.5 .
I have done almost everything that is said to do like-
1.find php.ini and add path
include_path = ".;C:\xampp\php\Zend\library\zend\;C:\xampp\php\PEAR;"
2.Extract the downloaded Zend Framework folder and copy to your PHP include path.
I have also checked the folder(xampp,php,Zend) permissions too.I have checked and rechecked my tries multiple times but that error is not solved.
Exception thrown trying to access Zend/Loader.php using 'use_include_path' = true. Make sure you include Zend Framework in your include_path which currently contains: .;C:\xampp\php\Zend\library\zend\;C:\xampp\php\PEAR;
It has already taken mine whole day to check other forums,get ideas but none of then works.Please help .Thanks
Your path should probably be C:\xampp\zend\library\Zend.
You shoulnd't take the framework to the global include path but have it as a dependency in your project, soon you'll have two projects with two different versions of ZF and then the global option creates troubles
Hi there finally after doing every possible tries,my error was gone.
I don't know other cases but in my case i have done a series of mistake.So as i corrected them the error was gone.Here is what i did
1.In ZendFramework-2.0.5 the loader.php was missing.So following error occured
Exception thrown trying to access Zend/Loader.php using 'use_include_path' = true. Make sure you include Zend Framework in your include_path which currently contains: .;C:\xampp\php\Zend\library\zend\;C:\xampp\php\PEAR;
For this i downloaded the ZendFramework-1.12.0(only in my case).And Loader.php was there
2.No two mistake of mine was i fractured the path from half.
i.e.If my folder structure was like
ZendFramework-1.12.0/library/Zend/..I add the half path to php.ini file
include_path = ".;C:\xampp\php\PEAR\;C:\xampp\php\Zend;"
which was a mistake so i, gave the path before the library folder
include_path = ".;C:\xampp\php\PEAR\;C:\xampp\php\Zend\library;"
and placed the folders according to path.
3.And what about environmental variables i read about?
They are not neccessary while installing the ZendFramework for the first time.After it i am not in that condn to say whether it should be added or not environmantal variables
C:\xampp\php
So,after doing above mentioned corrections and checking through the installation checker the error was gone.
And remember to restart(start and stop) the apache server after a tiny change in php.ini file.
thanks to markus-tharkun and Seth Battin a lot.You saved me.
I'm trying to include ZendFramework on a web site with no luck. Lately I gave a try at modifying the .htaccess file like this:
php_value include_path ":/home/u230474/Zend"
I also tried
php_value include_path ".:/home/u230474/Zend"
But on each case what happened was that I no longer could view any of the pages in the web site.
I did these modifications since I'm trying to make the system understand the following code:
<?php
$libreria='/Zend/ZendFramework/library';
set_include_path(get_include_path().PATH_SEPARATOR.$libreria);
require_once('Zend/Loader/Autoloader.php');
Zend_Loader_Autoloader::getInstance();
I've been trying things many days long now, and although I've talked to my provided we seem to have problems understanding the requirements.
I did a test to check the installation of ZendFramework with a script called InstallationChecker.php which is supposed to indicate the success in installing Zend Framework, and actually the script throws an error like this:
Exception thrown trying to access Zend/Loader.php using 'use_include_path' = true. Make sure you include Zend Framework in your include_path which currently contains: .:/usr/lib/php:/usr/local/lib/php
Which is why I tried modifying .htaccess
Does anyone know if I'm doing things wrong (obviously yes)? What is the right way to modify the htaccess file so that `/usr/lib/php and /usr/local/lib/php are included as well?
Also I've read that when you include a htaccess you must include also a .htaccess file to every subdirectory that makes an include. Most of my php scripts are directly in the public folder, but still I have many of them on subdirectories as well. How am I supposed to proceed?
I made some changes following Mike's advise and included the whole custom path like this:
$libreria='Zend/ZendFramework/library/Zend/Loader';
then I looked at php.info and it still doesn't show any changes to include_path. Additionally, I noticed that the error in the test I'm running to check if ZendFramework is installed is telling me there's a class Loader.php in the Zend folder, which is actually there, but still nothing gets loaded.
Ok so I did a couple of test to see what's going wrong, since the Zend Framework seems to load ok. First I added this code to the file 'libreria.php' which sets the include path (apparently alright, since the library is loaded). I did this:
$libreria='/home/u230474/public_classes/Zend/ZendFramework/library';
set_include_path(get_include_path().PATH_SEPARATOR.$libreria);
require_once('Zend/Loader/Autoloader.php');
$libload = Zend_Loader_Autoloader::getInstance();
if(!$libload) echo "Librería Zend Framework cargada"; else echo "Error al cargar la librería";
And as a result, it outputs: "Error al cargar la librería".
I also set up a tiny test to see if there's something wrong with the case sensitivity. On some of the pages that are having trouble, I put this code inmediately after including the header and the library:
//codigo para probar equidad de nombre de archivo---------->
$filename = basename($_SERVER['SCRIPT_FILENAME']);
$request = basename($_SERVER['SCRIPT_NAME']);
if($filename != $request)
die('Case of filename and request do not match!');
And it does not die, so it's ok. (If I get it right the result would be different if there was a slight difference in my file names, as are seen on the browser address, and as are seen by the server, but maybe I'm wrong).
Then, there's something going on with the way I call the Autoloader.php class, but I don't see a different way of calling it than the static method on Zend's introduction to Autoloader documentation, where it says 'Autoloader, basic usage'
.htaccess is probably not the place to make this change, as it will be more difficult to append the new path you want to include to the existing. What you did was overwrite all the include paths with just the one you specified in .htaccess. This blowd things up.
If you look at the 2nd line of the PHP code you included, it shows you how to append to the include path (by getting the current path and appending a new path to it.) Just do similar for the path you want to include.
Should ZF and PHP have the same path to include in php.ini, or can they be put in separate directories? This is the include path in my php.ini:
;Windows: "\path1;\path2"
include_path = ".;C:\xampp\php\PEAR;C:\ZF\library\"
I couldn't find any Zend documents that specify which, copying ZF\library to xampp\php\PEAR or the entire ZF directory, or using multiple include paths, is recommended for MVC app production. Is there a good practice or does it depend more on not having access to a certain part of a server or if you are using shared hosting, combining PHP and ZF would be the better option?
Should ZF and PHP have the same path to include in php.ini, or can
they be put in separate directories?
It is fine to have multiple directories listed in your php.ini.
include_path = ".;C:\xampp\php\PEAR;C:\ZF\library\"
The following would be better:
include_path = "C:\xampp\php\PEAR;C:\ZF\library\"
In other words, you don't need the "." in your path since anything that needs to be included in the current working directory can be included like this "./path/to/file.php".
Furthermore, you will want to use an autoloader but having the autoloader search ".", is more work than is needed.
Finally, I generally have an include path of:
include_path = "C:\xampp\php\PEAR"
The reason is that since PHPUnit is generally installed via the PEAR installer, I always want that globally available; however, for everything else, I can wait until I have access to a PSR-0 compliant autoloader.
Hope that helps.
after downloading Zend framework 1.11 on Ubuntu 11 ,when I try to create new project I got warning php_Unit was not found in your include path,after I had installed the phpUnit I got a lot of other warning so what the problem here ?? and how to set it ?
You'll need to check PHP's path variable. You can put this in your script to reveal it:
echo get_include_path();
It will show probably a handful of different system paths where PHP's autoloader will look for the classes it needs. Make sure PHPUnit is in one of these paths, or modify your path to include the location of PHPUnit on your system. It sounds like maybe Ubuntu 11 introduced a regression where either the default PHP path or the location of PHPUnit no longer match up.
I'm trying to get started with unit testing and PHPUnit. I see code here that indicates the way to get started is to include 'PHPUnit/Framework.php' and then create a test case that extends PHPUnit_Framework_TestCase
It looks like that's no longer the way to include PHPUnit but the new docs don't explain what files needed to be included to make PHPUnit work.
What am I missing? When I include 'Framework.php' an error is triggered that tells me no to include that file any longer. 'Autoloader.php' does not work either. When I include files such as 'TestSuiteLoader.php' and others I'll inevitably run into an error that tells me another needed file is missing. I doubt I'm supposed to manually include dozens of files but the docs aren't clear on what I should include yet.
You should include the phpunit library in your php.ini's include_path rather including them manually.
My include path is include_path = ".;C:\wamp\library\phpunit";