zendframe work phpUnit warning - php

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.

Related

how to change the unix PATH value in php environment

I've recently installed a composer library which heavily relies on the unix $PATH variable being set correctly.
Usually this isn't an issue, but unfortunately there is no way for me to override the functionality of this library.
Currently, when I echo out the $PATH, PHP will spit out:
/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
When it needs to be:
/usr/local/bin
After searching around for a bit, I came across the dotenv library as a potential solution using $_ENV["PATH"] = "...". However, this didn't work.
Following that, I attempted to simply execute this at the top of my initialisation file:
exec("PATH=/usr/local/bin")
echo shell_exec("echo $PATH");
Also to no avail.
So, how would one do this within PHP? Specifically in a MAMP environment on OSX. Is there a config setting I can change?
If you need to do it with PHP in the PHP environment, you can use putenv().
putenv("PATH=/usr/local/bin");
Or if you just want to prepend your path
$oldpath = getenv('PATH');
putenv("PATH=/usr/local/bin:$oldpath");

Zend framework in Xampp

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.

No include_paths are working for Zend

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.

Cakephp 2.0.4 bake error

I tried bake with Cakephp 2.0.4 stable with 'cake bake' command
But it's giving me below errors...
Unable to set console path for app/Console.
CakePHP is on your `include_path`. CAKE_CORE_INCLUDE_PATH will be set, but commented out.
Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in /home/wmetools/public_html/security/app/Console/myapp/webroot/index.php
Project baked but with some issues..
Your database configuration was not found. Take a moment to create one.
Is there a reason why this is happening?
If you meant to say
CakePHP is not on your include_path
** Code from the webroot/index.php file **
For ease of development CakePHP uses PHP's include_path. If you
cannot modify your include_path set this value.
Setting the include path will get rid of this error. There are two ways to accomplish this:
Edit your php ini file (on wamp this would be WAMPMENU->PHP->php.ini)
Better Description on how to.
or
// THIS METHOD IS NOT RECOMMENDED FOR THIS SITUATION
1. ini_set("include_path", ".:../:./include:../include");
If you do not want to mess with all that, just set the include path manually in the index.php file.

Doctrine inextricable string of require_once dependancies

I am trying to use a pear installation of Doctrine, it seems like all of the Requires and Class Names are just looking in the wrong places... do I need to be updating this all in cli-config.php (or similar file)? I don't understand how to get all of these things resolved.
before I go hard-coding all of the requires, I assume there is an elegant way to get this to work. for instance...
Class 'Doctrine\DBAL\Configuration' not found in
/usr/local/pear/share/pear/Doctrine/ORM/Configuration.php on line 41
so my pear install path is /usr/local/pear and the pear doctrine install seems to be /usr/local/pear/share/pear/Doctrine
I have been reading documents, and it seems to work in the sandbox from the cli, but, I don't really have a very modern understanding of PHP. I have been looking through the documentation, and there is probably a very simple step that I am missing, but I do not see it.
try running php like
php -d include_path=/usr/local/pear/share/pear
if this works, you may be missing that path in your include_path
try to issue a phpinfo() or var_dump(ini_get('include_path')) to actually see your include path, the directory Doctrine should be located somewhere inside that path

Categories