I am working on a Symfony 3.3 based application. I have my project locally installed and installed on a server. My laptop and server are both running Ubuntu 16.04.
On my local machine the prod and dev are both error-free. However when I want to visit the prod on the server I get the following messages in my var/logs/prod.log
php.CRITICAL: Undefined class constant 'HEADER_X_FORWARDED_FOR' {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Undefined class constant 'HEADER_X_FORWARDED_FOR' at /home/webwijs/birdbook/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php:122)"} []
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Undefined class constant 'HEADER_X_FORWARDED_FOR'" at /home/webwijs/birdbook/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php line 122 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Undefined class constant 'HEADER_X_FORWARDED_FOR' at /home/webwijs/birdbook/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php:122)"} []
It might be important to know that it is an installation upgraded from symfony 3.1.
I had the exact same issue.
Basically I dump the Request filepath and it was the old one from SF3.2 loaded from the var/bootstrap.php.cache loaded instead of the new one in Symfony\Component\HttpFoundation\Request.
Just remove your var/bootstrap.php.cache file then clear your cache and everything will be fine.
Related
I have Magento 2.3 and I want to use Magento Functional Testing Framework version 2.3 but when I run the command vendor/bin/mftf run:test AdminLoginTest to run the test, the following error occurs:
==== Redirecting to Composer-installed version in vendor/codeception ====
Fatal error: Uncaught Error: Call to undefined function Codeception\Lib\codecept_absolute_path() in /Users/hanhan/Deskto
p/workspace/magento2/vendor/codeception/codeception/src/Codeception/Lib/ParamsLoader.php:25
In the file PramsLoader.php, codecept_absolute_path() method is invoked and it gives the error because this method is not defined
$this->paramsFile = codecept_absolute_path($paramStorage);
How can i solve this ?
I happened to encounter the same error today. It's because there is an old vendor directory in dev/tests/acceptance where previously we store composer.json file and now moved to root. Deleting dev/tests/acceptance/vendor folder resolve the fatal error.
I have an application running in my localhost developed in codeigniter. I uploaded to server but the application doesn't run. All credentials have been changed to match the server settings. I have viewed this answers but seem irrelevant to my situation as it is running in localhost: Error message Strict standards: Non-static method should not be called statically in php and Codeigniter Model Fatal error: Using $this when not in object context
The error I'm getting is here:
A PHP Error was encountered
Severity: 8192
Message: Non-static method login::index() should not be called statically
Filename: MX/Controller.php
Line Number: 169
Fatal error: Uncaught Error: Using $this when not in object context in
/var/www/html/stallion/application/modules/admin/controllers/login.php:13
Stack trace: #0
/var/www/html/stallion/application/third_party/MX/Controller.php(169): login::index() #1
/var/www/html/stallion/system/core/CodeIgniter.php(326):
MX_Controller->_remap('index', Array)
#2 /var/www/html/stallion/index.php(203):
require_once('/var/www/html/s...') #3 {main} thrown in
/var/www/html/stallion/application/modules/admin/controllers/login.php on line 13
Thanks.
I'm running this on Ubuntu 14.0 php version 7.0 so I can't understand why it's working in my localhost and on the server I get this error!
I reckon it's a php issue because I just uploaded to a different server and it works fine. Same OS but different php versions
I've just started using Symfony. I've put a test page (API) together and to get the JSON body being passed in I use Request:getContent(). This works well and as expected on my dev machine (Mac OS X 10.11.4, MAMP with PHP 5.6.10. When I deploy to the test server, Ubuntu Server 16.04 LTS with PHP 7.0.4 it throws the error:
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Fatal error: Using $this when not in object context" at /var/www/html/symfony_api/var/bootstrap.php.cache line 1008 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Fatal error: Using $this when not in object context at /var/www/html/symfony_api/var/bootstrap.php.cache:1008)"} []
Simply commenting out the request line and using normal PHP to get the body using file_get_contents('php://input') caused the class to work as expected on both machines.
Thanks for any help.
The getContent() metod is not static method of Request class (http://api.symfony.com/2.8/Symfony/Component/HttpFoundation/Request.html#method_getContent), use:
$request->getContent();
I've just installed vanilla Symfony 2.5.5 using composer and got fatal error exception by just visiting app_dev.php:
FatalErrorException: Compile Error: Cannot redeclare class Twig_Node_Expression_Binary_Or in /var/www/symfony/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php line 13
and also
Fatal error: Class 'Twig_Node_Expression_Binary_Sub' not found in /var/www/symfony/vendor/twig/twig/lib/Twig/ExpressionParser.php on line 52
I'm totally puzzled. I've grepped through the symfony but didn't find anything suspicious. This never happened to me before and frankly, I don't have idea what might be the cause of this.
I got a error when I try create a project using the zend framework command line:
[user ~] /home/user/public_html $ zf create project openstart
PHP Catchable fatal error: Argument 1 passed to Zend_Tool_Framework_Client_Console_ArgumentParser::setArguments() must be an array, null given, called in /home/user/downloads/ZendFramework-1.10.5/library/Zend/Tool/Framework/Client/Console.php on line 194 and defined in /home/user/downloads/ZendFramework-1.10.5/library/Zend/Tool/Framework/Client/Console/ArgumentParser.php on line 79
Catchable fatal error: Argument 1 passed to Zend_Tool_Framework_Client_Console_ArgumentParser::setArguments() must be an array, null given, called in /home/user/downloads/ZendFramework-1.10.5/library/Zend/Tool/Framework/Client/Console.php on line 194 and defined in /home/user/downloads/ZendFramework-1.10.5/library/Zend/Tool/Framework/Client/Console/ArgumentParser.php on line 79
zf is a symlink to /home/user/downloads/ZendFramework-1.10.5/bin/zf.sh
Any ideas?
Try a newer version of Zend Framework if possible, they are at 1.11.10 now and I think a number of zend tool issues have been resolved since then.
If I run your command on the newest version I get no errors and the project is created.