Doctrine inextricable string of require_once dependancies - php

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

Related

Attempted to load class "Memcached" from the global namespace. Did you forget a "use" statement?

I have setup existing symfony project to my local machine(windows). After composer install i get a error like this .
ClassNotFoundException in Memcached.php line 6:
Attempted to load class "Memcached" from the global namespace.
Did you forget a "use" statement?
Without detailed look into your configuration, I can only offer you a checklist with which you could give it a shot and see which part is missing.
The quesiton is tagged under symfony, so I assume that you installed a bundle. Was it leaseweb/memcache-bundle, or was some other?
Try examinging your vendor directory and try to identify if you have any of Memcached related classes.
If question to (1) is false, you may be missing some psr-4 mappings. Try examining your autoload.php and look for Memcached specific namespace.
Do you actually have php-memcached php extension installed? Have you enabled it? Try running php -m and look for php-memcached or something like that.
Please provide more info and we might be able to narrow it down.
Hope this helps.
Download the php_memcached.dll from here and place it in the ext directory. If you are using a php version older than 7.3 also download the libmemcached.dll and place it in the php root directory. Don't forget to enable extension from the php.ini file.

Class 'Google\Protobuf\Internal\Message' not found in "Message.proto"

I'm working on a project with protocol buffers and after i compiled a proto file, i cant seem to include it neither run it cos it keeps giving me this exact error:
PHP Fatal error: Class 'Google\Protobuf\Internal\Message' not found in /app/generated_files/message.php on line 13
On message.php i have the auto generated file from a .proto file and it includes Google\Protobuf\Internal\Message.
While reading on the protobuf github issues, i found that a person had the same problem where he concluded that it was the composer's fault. However in my case that wouldnt be the issue cos i didnt use composer.
I used pecl to install protocol buffers, and i have the library protobuf.so located in /etc/php5/apache2/XXXXXXXXX. I also added extension=protobuf.so on the last line of php.ini.
Keep in mind that im using docker for everything, therefore it might be something different but i still doubt.
In case anyone ends up here with the same question: you just need to add componser autoloader to your file include_once './vendor/autoload.php'; (change path as required)
I had the same problem, but the reason was different for me:
Git somehow messed up the casing of the folders, which lead to a wrong file path translation.
As soon as I fixed the casing ([...]/src/Google/Protobuf instead of [...]/src/google/protobuf in the vendor folder)

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.

zendframe work phpUnit warning

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.

Help me correct my php include path on windows 7, i've hit a block

i've been suggested to use the ZFDotrine from a post here but right now it turns out to be kind of headache where i don't know why zf can't see the zfdoctrine provider.
I have a kind of shady environment on my windows 7.i have xampp 1.7.3 and zend server5.0.2 on my machine each with a different version of zf.so i downloaded zf 1.10.8 under drive c (C:\ZendFramework) and referenced its bin in the environment variable path, and its library in php.ini. i've removed c:/xampp/php/PEAR/zend folder and c:/xampp/php/zf.bar | zf.php. i also have netbeans 6.9 created the zf.ini for me.After some issue with NetBeansCommandsProvider i got everything working fine, from command line tool project create to tool from netbeans.
xamp/php.ini
include_path = ".;C:\xampp\php\PEAR;C:\ZendFramework\library;"
zendserver/php.ini
include_path=".;C:\ZendFramework\library"
in zf.ini i have change php.includepath to php.include_path
php.include_path = "C:\ZendFramework\library;.;C:\Users\sensei\ .netbeans\6.9\zend;C:\ZFDoctrine;"
basicloader.classes.0 = "NetBeansCommandsProvider"
So with ZFDoctrine physically under C and referenced in zf.ini i thougth everything would work out but i'm having errors
Failed opening 'ZFDoctrine\Tool\DoctrineProvider.php' for inclusion (include_path='.;C:\xampp\php\PEAR;C:\ZendFramework\library;C:\ZFDoctrine;') in C:\ZendFramework\library\Zend\Loader.php on line 147
for the command zf enable config.provider ZFDoctrine_Tool_DoctrineProvider
Apparently when i copy ZFDoctrine folder to C:\ZendFramework\library\zend\ it works.that makes me realize there is something wrong with the include_path.
i'm thinking also about copying it to the PEAR folder but that too, i don't know if that's the best way to go.I just don't understand why it can't find the ZFDoctrine folder.
I'm kinda stuck.Please has anyone successfully using this to share his experience with me?Can you point out what i'm not doing right? thanks for reading this.this is a kind of blocker to me
Zend_Tool uses the include path in zf.ini, so it's this one you need to double check:
php.include_path = "C:\ZendFramework\library;.;C:\Users\sensei\ .netbeans\6.9\zend;C:\ZFDoctrine;"
What is the correct full path to DoctrineProvider.php? At the moment it's looking for:
C:\ZFDoctrine\ZFDoctrine\Tool\DoctrineProvider.php
which doesn't look right. Assuming you've extracted the full ZFDoctrine to C:\ZFDoctrine, then should it be:
php.include_path = "C:\ZendFramework\library;.;C:\Users\sensei\ .netbeans\6.9\zend;C:\ZFDoctrine\library;"

Categories