PHP parser errors in Zend Framework - php

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!

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.

CakePHP 3.0 not running on other machines

I've developed a small project on a machine, using CakePHP 3.0, and I need it to run on another machine. I've tried to install it on several other machines.
If I run the composer to install the CakePHP 3.0, then I copy my stuff to overwrite it, the project works. I've tried this on two machines and had no problem so far. If I don't run the composer, and just copy the stuff to the target machine, it gives me the following error. I've tried this on 3 machines, and every machine gives me this:
Fatal error: Class 'Locale' not found in /home/u113681897/public_html/vendor/cakephp/cakephp/src/I18n/I18n.php on line 229
Fatal error: Class 'Locale' not found in /home/u113681897/public_html/vendor/cakephp/cakephp/src/I18n/I18n.php on line 229
I've copied the whole project to this server to test.
I told you this because I thought it has something to do with my problem. The point is that I have to run this on a machine that is not mine, and I can't install composer on it. The /public_html/vendor/cakephp/cakephp/src/I18n/ has files related to internationalization and localization, but my project will never be translated, so a workaround to make the project ignore those files would be enough to solve my problem.
The following code is an excerpt from the (...)/I18n/I18n.php that might be relevant:
<?php
namespace Cake\I18n;
use Aura\Intl\FormatterLocator;
use Aura\Intl\PackageLocator;
use Aura\Intl\TranslatorFactory;
use Cake\I18n\Formatter\IcuFormatter;
use Cake\I18n\Formatter\SprintfFormatter;
use Locale;
class I18n {
// lots of code here
public static function defaultLocale() {
if (static::$_defaultLocale === null) {
static::$_defaultLocale = Locale::getDefault() ?: 'en_US';
// the line above is the Line 229
}
return static::$_defaultLocale;
}
// many code here too
}
I've checked that another file also tries to access this Locale class, but I don't know if there are other files trying to access it as well. Many files from everywhere inside the project tries to access methods from I18n.php. I need it running but I can't figure out how to make it run.
Any help will be greatly appreciated.
As I just found out, prior to CakePHP 3.0, the installation must be done by composer, as stated in the 3.0 migration guide:
CakePHP should be installed with Composer
Since CakePHP can no longer easily be installed via PEAR, or in a shared
directory, those options are no longer supported. Instead you should use
Composer to install CakePHP into your application.
So it won't run on regular free web hosting services.

sf2 php command-line issues for deployment #OVH

Hi there,
I am facing a quite annoying issue.
Situation
I would like to deploy symfony2 application in production on mutualized servers of OVH (pro). I got shell access (ssh), my database works fine and my files are online.
Issue
I cannot manage to make any php command line work. That is, for all major commandline:
- updating web directory : php app/console assets:install web
- updating databases: php app/console doctrine:schema:update --force
- downloading composer: php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"
-etc...
I get parse errors such as:
syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in
or
Error in argument 1, char 2: option not found r (that one was for composer download)
it seems a pretty common pb, however I couldn't manage to fix it :/
Any hints welcome!
Thanks in advance,
Cheers
On ovh, you can choose witch php is used by altering the cmd line :
/usr/local/bin/php.ORIG.5_4 -> php.ORIG.5.4.6
/usr/local/bin/php.ORIG.5_3 -> php.ORIG.5.3.16
/usr/local/bin/php.ORIG.5_2 -> php.ORIG.5.2.17
/usr/local/bin/php -> php.ORIG.4
I had a simular problem with deploying symfony2 project. I`m not sure that this is the case here, but my problem was with the cache. For some of the symfony2 console commands it uses cached paths, and if you have changed the location of the project this could cause the problem. It uses a cached path when trying to delete the cache :D so my suggestion is to go and delete manually the cache i app/cache.
Hope i helped

Call to undefined function menu_load() in .../public_html/includes/menu.inc on line 579

I really need your help. Actually, my journey begin with the installation Drupal and some modules. After a couple of days I suddenly get an issue "500 Internal Server Error".
I asked my hosting provider why this happened, he said "That because of the file .htaccess and you should add to this file php display error". So i did this and I get a new issue :
"Fatal error: Call to undefined function menu_load() in ...
/public_html/includes/menu.inc on line 579."
By the way, that's line 579
else {$return = $function($value);}
P.S: I am a beginner in PHP. I like Drupal a lot and want to study Drupal in further and create cool sites, but this problem...
need to figure out what function it's trying to call first.
change the line
else {$return = $function($value);}
to
else {echo $function;exit;$return = $function($value);}
Here are few tips:
make sure your Drupal core has all the files in the right place (especially menu module),
make sure your imported database is in UTF-8 format,
upgrade your Drupal core to the latest version (drush fr && drush up drupal)
clear all your caches (drush -y cc all), including your memcached (killall memcached),
rebuild your registry by using [Registry Rebuild][1],
if you're using modules which are implementing drupal_bootstrap() (such as Secure Site), disable them,
try disabling your PHP cache engines (such as XCache, Zend optimizer) to see if that's the problem,
test it on different environment/machine,
eventually restore your database from the point where it was working before

Configuring MongoDB + doctrine in Symfony

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.

Categories