Doctrine error when deploying symfony2 app on pagoda box - php

I'm getting a doctrine error after deploying my app on PagodaBox. It works fine in both dev and prod environments on my local machine but the live site returns this error:
Fatal error: Uncaught exception 'LogicException' with message 'Illegal value passed (no array or string given)' in /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php:101 Stack trace: #0 /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php(101): spl_autoload_register(NULL) #1 /var/www/app/bootstrap.php.cache(2275): Doctrine\Bundle\DoctrineBundle\DoctrineBundle->boot() #2 /var/www/app/bootstrap.php.cache(2303): Symfony\Component\HttpKernel\Kernel->boot() #3 /var/www/web/app.php(23): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #4 {main} thrown in /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php on line 101
The cache is cleared every time the app is deployed.
Any suggestions would be gratefully received because I'm totally stumped!
UPDATE:
I've done some more debugging and I have discovered that even in the prod environment the kernel.cache_dir parameter is set to /var/www/app/cache/dev. This means that the doctrine cache dir is being incorrectly set as it relies on this other parameter. I thought the kernel.cache_dir was set automatically depending on the environment.

I finally got this sorted. It was down to using eAccelerator as my opcode cache. It turns out that there is a bug in eAccelerator that means it can't process closures correctly. I'm now using XCache and it is all working fine.

This is the auto-loading failing in DoctrineBundle.php Line 101:
$this->autoloader = Autoloader::register($dir, $namespace, $proxyGenerator);
Your passing NULL to the $dir argument, which judging by the exception its requires either an array() or string.
You can see that the method uses $dir from the configuration variable doctrine.orm.proxy_dir (Line 64).
$dir = $this->container->getParameter('doctrine.orm.proxy_dir');`
My guess is that you have not defined this path correctly
Edit - Take a look here for Doctrine's configuration which includes the proxy_dir setting.

Related

Google\Cloud\Storage\StorageObject->downloadAsString() uncaught error

I have a PHP script that reads files from Cloud Storage. It works fine in local dev. But when it's run in App Engine standard environment, it outputs this error message:
Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException in /srv/vendor/google/cloud/Core/src/RequestWrapper.php:362
Stack trace:
#0 /srv/vendor/google/cloud/Core/src/RequestWrapper.php(206): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\RequestException))
#1 /srv/vendor/google/cloud/Storage/src/Connection/Rest.php(224): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array)
#2 /srv/vendor/google/cloud/Storage/src/StorageObject.php(643): Google\Cloud\Storage\Connection\Rest->downloadObject(Array)
#3 /srv/vendor/google/cloud/Storage/src/StorageObject.php(574): Google\Cloud\Storage\StorageObject->downloadAsStream(Array)
#4 /srv/modules/profile/controllers/getresource.class.php(69): Google\Cloud\Storage\StorageObject->downloadAsString()
This doesn't happen to most of the files. The file causing this issue is about 250KB. I am wondering is there some kind of size limitation with downloadAsString()?
One of the files causing this issue is https://www.justjeans.com.au/wcsstore/JustJeansAuroraStorefrontAssetStore/css/main.css?timestamp=2019070295000
The downloadAsString() method downloads the file using stream, and then casts it to a string before returning it.
Link to the SDK code
There should not be any issues with file sizes unless you are running out of memory in your PHP process.
Is there a file that causes the issue every time? If so, maybe adding that to the question would be a good idea.

Unable to read the "../.dev.env" environment file in Dotenv.php:symfony

I want To run a symfony project in my computer but I get all times errors , and now I get this error and i didn't find any solution for my problem
Problem Failed to parse output as xml: Error on line 2: Content is not
allowed in prolog.. Command C:\xampp\php\php.exe
C:\xampp\htdocs\buzzaka\bin\console list --format=xml Output
Fatal error: Uncaught
Symfony\Component\Dotenv\Exception\PathException: Unable to read the
"C:\xampp\htdocs\buzzaka\bin/../.dev.env" environment file. in
C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php:466 Stack
trace:
0 C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php(51): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
1 C:\xampp\htdocs\buzzaka\bin\console(38): Symfony\Component\Dotenv\Dotenv->load('C:\xampp\htdocs...')
2 {main} thrown in C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php on line 466
If u move your file from the folder where it was created symfony will keep looking for it on this folder, i've went on autoload_runtime and changed on $runtime variable where the project is, just worked for me, lets see on the last composer dump what just happens haha
The error is quite explicit, do you have a file C:\xampp\htdocs\buzzaka\bin/../.dev.env ?
Well, you need to create one. As announced a little while ago, Symfony will now require a .env file per environment. As you are running your command in the dev environment, you need to create a .dev.env file.

Fatal error because an Error instance is being passed instead of an expected Exception instance

I just installed xampp with php 7.0.4 and a fresh cakephp 3.2.6.
I did a lot of research and everything I found shows that they are compatible.
However as soon as I go to open the application with a browser, cake replies with an Internal Error.
The only pointer as to what to do is that xampp logs the following in apache error.log:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Cake\Error\BaseErrorHandler::handleException() must be an instance of Exception, instance of Error given in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php:153
Stack trace:
#0 [internal function]: Cake\Error\BaseErrorHandler->handleException(Object(Error))
#1 {main} thrown in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php on line 153
I tried php 5.6 but it still shows the error in the log.
If that's the error that you are encountering, then I'd doubt that you are using CakePHP 3.2.6, as line 153 is in the middle of a comment
https://github.com/cakephp/cakephp/blob/3.2.6/src/Error/BaseErrorHandler.php#L153
PHP7 errors are handled since CakePHP 3.1.5, so check your CakePHP dependency, and make sure it's actually up to date.

Pushing a Zend Application into Amazon EC2 Instance

I'm trying to push a zend application onto an amazon EC2 instance.
I have set up my Zend application on the server and have set up the httpd conf.
When I try to access my website through the browser, I get the following message printed:
bootstrap() ->run();
I have followed all the standard procedures and am able to see static HTML files. But when I try to access PHP files, I see a blank page.
I checked the log files but those do not return any errors.
Any idea why I'm facing this issue.
Update:
I updated my php.ini file with the zend library include_path.
Now I'm faced with the following error:
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource
matching "Jquery" not found' in /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap
/BootstrapAbstract.php:694 Stack trace: #0 /usr/share/php/libzend-framework-php/Zend/Application
/Bootstrap/BootstrapAbstract.php(626):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('Jquery') #1 /usr/share/php/libzend-
framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php(586):
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #2 /usr/share/php/libzend-framework-
php/Zend/Application.php(355): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap(NULL) #3
/var/www/html/urban-chatter/public/index.php(29): Zend_Application->bootstrap() #4 {main} thrown in
/usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php on line 694
Solved:
I copied the zend library from my system onto the server and changed the include_path to the new library in php.ini file and everything started working. I think there was some compatibility issues when I used another version of zend library.

Apigility v1.0.4 REST API GET methods no longer get valid parameter array

I used Apigility to generate code-connected REST API wrappers for my ZF2 project - it all worked nicely (apart from a few file permissions issues which were easily resolved on the command line). Yesterday I ran a composer update and it updated Apigility to 1.0.4 and now my collection GET methods (with signatures fetchAll($params = array()) are getting called with an empty parameter array. I can see from Firebug console that these are still being called with the correct parameters browser side so it appears that something has changed with the Apigility wrapper processing that has broken this. Does anyone have any knowledge or can shed any light on why this might have changed / broken?
I also discovered that since the update I can't access the Apigility Admin UI that was used to generate the API wrappers, since it fails to load with a ZF2 routing error:
Fatal error: Uncaught exception 'Zend\Mvc\Router\Exception\RuntimeException' with message 'Part route may not terminate' in /private/var/www/vhosts/hamster.local/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/Part.php:202 Stack trace:
#0 /private/var/www/vhosts/hamster.local/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/TreeRouteStack.php(351): Zend\Mvc\Router\Http\Part->assemble(Array, Array)
#1 /private/var/www/vhosts/hamster.local/vendor/zendframework/zendframework/library/Zend/View/Helper/Url.php(100): Zend\Mvc\Router\Http\TreeRouteStack->assemble(Array, Array)
#2 [internal function]: Zend\View\Helper\Url->__invoke('zf-apigility')
#3 /private/var/www/vhosts/hamster.local/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(399): call_user_func_array(Object(Zend\View\Helper\Url), Array)
#4 /private/var/www/vhosts/hamster.local/vendor/zfcampus/zf-apigility-admin-ui/view/zf-apigility-ui.phtml(6): Zend\View\Renderer\PhpRenderer->__call('url', Array)
#5 /private/v in /private/var/www/vhosts/hamster.local/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/Part.php on line 202
Again I have no clue what might have caused this other than a borked update of Apigility. Regressing to v1.0.3 fixes both of these issues, but I'd like to have some of the updated features in 1.0.4.
Any help greatly appreciated!
In order to access to apigility admin, go to the file:
vendor/zfcampus/zf-apigility-admin-ui/view/zf-apigility-ui.phtml
and commet the line 6 and 14.
Maybe there are some problems with the routes.

Categories