Configuring MongoDB + doctrine in Symfony - php

I was trying to install MongoDB doctrine bundle as written in here
But when I ran the command
$ php bin/vendors install
It throws up the following error:
Fatal error: Call to undefined method
Doctrine\ODM\MongoDB\Configuration::setLoggerCallable()in
C:\wamp\www\Symfony\app\cache\dev\appDevDebugProjectContainer.php on line 245
I have followed the installation instructions to the word (which has not been much anyways...) and i have also double checked my installation... Is there something I am missing here?
Update : A similar problem is mentioned here, but even after following the answer there, i could not successfully configure DoctrineMongoDBBundle.

The latest changes in the Doctrine MongoDB repo have introduces this problem. To stick to a version before this happened, add this line to deps.lock:
doctrine-mongodb 5ccb18231218ce92c9d72295f69bebfe172ef5fb

Well, finally I managed to solve it by adding this to the deps file:
[DoctrineMongoDBBundle]
git=http://github.com/symfony/DoctrineMongoDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
version=origin/2.0
** note the
version=**origin**/2.0
which is different from the previously suggested simple
version=2.0.0 or something similar...
I have a hunch that this problem occurs only on Windows, I hope someone could kindly confirm this.

Related

PHP Fatal error: Class 'WP_UnitTestCase' not found when trying to run test-sample

I am trying to initialize php unit testing with my wordpress plugin using phpunit. I am running xampp on windows. My xampp installation is also on my E: drive if that makes any difference. I am following along with this tutorial:
https://www.smashingmagazine.com/2017/12/automated-testing-wordpress-plugins-phpunit/
I have gotten to the part where I run
install-wp-tests.sh wordpress_test root '' localhost latest
I run that and it pops up and closes quickly, so I don't know if it is really working or not. I then try to run
phpunit tests/test-sample.php
and I get:
PHP Fatal error: Class 'WP_UnitTestCase' not found in E:\xampp\htdocs\wp-content\plugins\SRBC\tests\test-sample.php on line 11
Fatal error: Class 'WP_UnitTestCase' not found in E:\xampp\htdocs\wp-content\plugins\SRBC\tests\test-sample.php on line 11
I assume that means the install-wp-test.sh isn't installing correctly and it is missing those classes. Any ideas?
Ended up needing to install SVN for windows. Also had to add the mysqladmin.exe path to the PATH environment variable. Then finally needed this :
https://wordpress.stackexchange.com/questions/249402/error-when-setting-up-phpunit-tests-with-wp-cli-scaffold
And after all that and 3 hours! I got it to work correctly!
Hope this helps someone else.

MongoDb not found in ZF2 controller

I have few controllers in my zf2 project which work perfectly in the browser using apache and via command line.
However, I recently installed MongoDb so I can store some data using the driver found in (http://php.net/manual/en/set.mongodb.php)
My issue is, when I try to access the driver via controller + browser, I get the following message error in my apache logs :
PHP Fatal error: Class 'MongoDb\Driver\Manager' not found.
'MongoDb\Driver\Manager' is the namespace for this Driver.
If I execute some other controllers via command line, MongoDb works correctly.
Does anyone know why is this happening? I cannot see the issue :(
Thank you
I found that my php.ini was pointing to mongo.so instead of mongodb.so
That fixed the issue
http://php.net/manual/en/mongodb.installation.manual.php
Thank you for your help

Fatal error: Call to undefined function httppost()

I am trying to make a project work. But I am getting an error like this:
Class 'App' not found in /var/www/html/project/test.php on line 4
line 4 of this file says:
app::$activepage = $_GET['_page'] ? httpget('_page') : $_POST['_page'] ? httppost('_page') : 0);
I am using cakePhp Version: 1.3.15-1.
The weird thing is that when I do apt show cakephp it says State: not installed
However, I have followed all the instructions of https://www.digitalocean.com/community/tutorials/how-to-install-cakephp-on-an-ubuntu-12-04-vps and when I open the index.php file of cakephp, it doesn't indicate any errors.
As I said in my Comment:
Your snippet / folder structure doesn't look like CakePHP.
Part of the problem may be a version mismatch. You say you're using version 1.3.15, but the tutorial on installing it that you link was created over a year later and references version 2.3.9. It looks like the general steps are the same, based on comparing your tutorial to the steps in the 2.X blog tutorial. You might have more luck with an older tutorial on using CakePHP on Ubuntu. Most of the steps look similar, but there are some differences with the .htaccess portion that could be causing the problem. Neither the 1.3 or 2.3 versions look like they require any "installing."
If you're not looking at the older version for any particular reason, of course it's best to use the most recent version of CakePHP, but I assume you have a particular reason for using that version. But if you're stuck, you might try a newer version to see if it gives the same errors.

What version of doctrine-mongodb-odm should I use with Symfony2 v2.0.12?

After some trial and error (ok, just error) I figured out that c089b69c3d contained something that broke my code, causing
Fatal error: Interface 'Doctrine\Common\Persistence\Proxy' not found
but the commit before that worked.
Is there any general recommendation of which version of doctrine-mongodb-odm should be used with the Symfony2 standard distribution v2.0.12?
Check your deps and deps.lock files for any version fixes on doctrine-common.
The doctrine-mongodb master branch sub-modules doctrine-common at commit fc26d10
See https://github.com/doctrine/mongodb/tree/master/lib/vendor.
Also see this question and answer for more information - Manually updating Symfony2 deps file to get Doctrine 2.2?
add in your deps.lock:
doctrine-mongodb-odm 2239012af4d7f9954898068e8458d7e1a0f6143f

PHP parser errors in Zend Framework

I just updated my project library folder (with an external to ZF svn) to ZF version 1.11. I'm now getting al kinds of weird errors, related to whitespaces, empty lines, etc. I searched on the internet for quite a while, but can't find a proper answer. I think this is related to some settings in my php.ini file but can't figure it out.
Example of an error:
Parse error: syntax error, unexpected $end in /library/Zend/Application.php on line 415 Call Stack: 0.0042 657160 1. {main}() /mnt/hgfs/htdocs/service/public/index.php:0
PHP version: PHP 5.3.5-0.dotdeb.1
All help would appreciated, I can't wrap my head around it!
I see you're running the project on a hgfs mount, probably inside your VM. Try to run your project off the hgfs mount as I found it to be buggy when dealing with these things.
For one, the default mount options don't keep into account that your file and directory properties (uid and gid) probably aren't the same on your guest and host system. Unfortunately, setting these right didn't fix it for me.
The solution I eventually used was to ditch the hgfs driver and mount the files using sshfs. On Debian you can just install it by running apt-get install sshfs. I then added an entry to /etc/fstab, like this:
sshfs#user#host:/path/to/host/dir /mnt/share fuse comment=sshfs,user,rw,exec,uid=1000,gid=1000,allow_other 0 0
Mounting the share can then be done by running this:
mount /mnt/share
Hope this helps!

Categories