i developed a symfony project.
Everything words fine on dev machines (using symfony server on port 8000).
When i clone the git in my production server i got this error:
Executing script cache:clear [KO] [KO] Script cache:clear returned
with error code 1 !! !! // Clearing the cache for the prod
environment with debug !! // false !! !! !! In
App_KernelProdContainer.php line 674: !! !! The parameter "21" must
be defined. !! !! !! cache:clear [--no-warmup]
[--no-optional-warmers] !! !! Script #auto-scripts was called via
post-update-cmd
I tried to:
delete the var/cache/* content
execute a php bin/console cache:pool:clear cache.global_clearer
set the env to prod and to dev
Nothing changes.
I have an ubuntu 20 with php-fpm7.4, mysql 8.0.
The error log shows:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught
Symfony\Component\DependencyInjection\Exception\InvalidArgumentException:
The parameter "21" must be defined. in
/var/www/html/lavanderiasolari/public_html/laundry_manager/var/cache/prod/ContainerJ6TfZkC/App_KernelProdContainer.php:674\nStack
trace:\n#0
/var/www/html/lavanderiasolari/public_html/laundry_manager/vendor/symfony/dependency-injection/EnvVarProcessor.php(281): ContainerJ6TfZkC\App_KernelProdContainer->getParameter()\n#1
[internal function]:
Symfony\Component\DependencyInjection\EnvVarProcessor->Symfony\Component\DependencyInjection\{closure}()\n#2
/var/www/html/lavanderiasolari/public_html/laundry_manager/vendor/symfony/dependency-injection/EnvVarProcessor.php(277): preg_replace_callback()\n#3
/var/www/html/lavanderiasolari/public_html/laundry_manager/vendor/symfony/dependency-injection/Container.php(415):
Symfony\Component\DependencyInjection\EnvVarProcessor->getEnv()\n#4
/var/www/html/lavanderiasolari/public_html/laundry_manager/var/cache/prod/Contai...'
I executed composer dump-env .env and he generated .env.local.php, with
return array (
'APP_ENV' => 'prod',
'APP_SECRET' => 'c6e083dd648f30951fb991cee1df42f9',
'DATABASE_URL' => 'mysql://[DBUSER]:'.urlencode('[dbpasswd]').'#127.0.0.1:3306/[dbname]?serverVersion=8.0',
);
What shall i do?
Thanks a lot.
Having the same error. The problem is comming from special characters in your password.
Indeed in .env variables you need to url encode. For example != become %21%2F but it cause error
The parameter “21” must be defined
Solution in config/packages/doctrine.yaml replace
url: '%env(resolve:DATABASE_URL)%'
by
url: '%env(DATABASE_URL)%'
Related
Whenever I try to create a new Symfony project using the following command:
composer create-project symfony/skeleton new_project
I'm getting these error messages in the console and I have no idea what causes it:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "C:\Users\ferra\Projects\PHPex\test_project/.env" environment file. in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php:567
!! Stack trace:
!! #0 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
!! #1 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv('C:\\Users\\ferra\\...', 'APP_ENV', 'dev', Array, false)
!! #2 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\runtime\SymfonyRuntime.php(107): Symfony\Component\Dotenv\Dotenv->bootEnv('C:\\Users\\ferra\\...', 'dev', Array, false)
!! #3 C:\Users\ferra\Projects\PHPex\test_project\vendor\autoload_runtime.php(23): Symfony\Component\Runtime\SymfonyRuntime->__construct(Array)
!! #4 C:\Users\ferra\Projects\PHPex\test_project\bin\console(11): require_once('C:\\Users\\ferra\\...')
!! #5 {main}
!! thrown in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php on line 567
!! PHP Fatal error: Uncaught Symfony\Component\Dotenv\Exception\PathException: Unable to read the "C:\Users\ferra\Projects\PHPex\test_project/.env" environment file. in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php:567
!! Stack trace:
!! #0 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(114): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
!! #1 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php(157): Symfony\Component\Dotenv\Dotenv->loadEnv('C:\\Users\\ferra\\...', 'APP_ENV', 'dev', Array, false)
!! #2 C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\runtime\SymfonyRuntime.php(107): Symfony\Component\Dotenv\Dotenv->bootEnv('C:\\Users\\ferra\\...', 'dev', Array, false)
!! #3 C:\Users\ferra\Projects\PHPex\test_project\vendor\autoload_runtime.php(23): Symfony\Component\Runtime\SymfonyRuntime->__construct(Array)
!! #4 C:\Users\ferra\Projects\PHPex\test_project\bin\console(11): require_once('C:\\Users\\ferra\\...')
!! #5 {main}
!! thrown in C:\Users\ferra\Projects\PHPex\test_project\vendor\symfony\dotenv\Dotenv.php on line 567
!!
Script #auto-scripts was called via post-update-cmd
The following command: 'symfony check:requirements' shows that my system is ready to run Symfony projects:
> PHP is using the following php.ini file:
C:\xampp\php\php.ini
> Checking Symfony requirements:
..............WWW......W..
[OK]
Your system is ready to run Symfony projects
Optional recommendations to improve your setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm not getting any errors when I try to create a demo project instead of a regular one (symfony new --demo new_project).
Does anyone know what's causing the error message when trying to create a new regular Symfony project?
Any kind of help is appreciated.
The only solution at the moment is to create the file .env manualy at the root of your project.
I encountered the error in composer version 1. Fortunately, I was able to fix this issue by updating to the latest version of the composer.
sudo composer self-update --2
I executed git reset --hard, but now I get:
PHP Fatal error: Uncaught Error: Class 'Magento\Setup\Application' not found in /home/xy/vendor/magento/framework/Console/Cli.php:79
Stack trace:
#0 /home/xy/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI')
#1 {main}
thrown in /home/xy/vendor/magento/framework/Console/Cli.php on line 79
I executed composer update in hope that this fixes it, but it doesnt. How can I fix?
It turned out that git reset --hard destroyed my setup folder for unknown reasons and not even git pull fixed it.
So I had to copy the folder from another project. Now it works.
I just run git reset --hard again and that fixed the issue.
This was the result that I get when I ran composer install to update composer dependencies and I've removed composer.lock to make sure updated dependencies will be downloaded.
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Declaration of App\Middleware\EventBusMiddleware::handle($message, callable $next) must be compatible with Symfony\Component\Messenger\Middleware\MiddlewareInterface::handle(Symfony\Component\Messenger\Envelope $envelope, Symfony\Component\Messenger\Middleware\StackInterface $stack): Symfony\Component\Messenger\Envelope in /var/www/html/src/Middleware/EventBusMiddleware.php on line 8
!!
!! In EventBusMiddleware.php line 8:
!!
!! Compile Error: Declaration of App\Middleware\EventBusMiddleware::han
!! dle($message, callable $next) must be compatible with Symfony\Component\Mes
!! senger\Middleware\MiddlewareInterface::handle(Symfony\Component\Messenger\E
!! nvelope $envelope, Symfony\Component\Messenger\Middleware\StackInterface $s
!! tack): Symfony\Component\Messenger\Envelope
!!
!!
!!
Script #auto-scripts was called via post-install-cmd
Can someone help me with understanding this error?
Can anybody help me to find out solution.
Problem: php artisan command not working on server(using putty name.com) but showing result on my local environment (command prompt windows).
Description: when i am running php artisan command using putty it throws error in my error logs.
PHP Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /home/hisunil4/intraview.co.in/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /home/hisunil4/intraview.co.in/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 103
I hope that all is well with you all.
I was following Gregor Gramlich's tutorial from http://ggramlich.github.io/phpslim/installation.html to http://ggramlich.github.io/phpslim/first_test.html. I was using phpslim.phar from that tutorial. And then I was using FitNesse of release 20161106.
So I have a problem after I hit the Test button. FitNesse give me a warning:
Unable to start test system 'slim': fitnesse.slim.SlimError: Got invalid slim header from client. Read the following:
Then I clicked the Execution Log button. The Standard Output give me a description:
PHP Warning: socket_bind(): unable to bind address [13]: Permission denied in phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim/SocketService.php on line 14
PHP Fatal error: Uncaught exception 'PhpSlim_SlimError' with message 'socket_bind() failed: Permission denied' in phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim/Socket.php:135
Stack trace:
#0 phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim/SocketService.php(16): PhpSlim_Socket->raiseError('socket_bind() f...')
#1 phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim/SocketService.php(6): PhpSlim_SocketService->bind()
#2 phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim/Server.php(24): PhpSlim_SocketService->init()
#3 phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim.php(29): PhpSlim_Server->run('1')
#4 phar:///home/lubuntu/Documents/Time/phpslim.phar/index.php(4): PhpSlim::main(Array)
#5 /home/lubuntu/Documents/Time/phpslim.phar(9): include('phar:///home/lu...')
#6 {main}
thrown in phar:///home/lubuntu/Documents/Time/phpslim.phar/PhpSlim/Socket.php on line 135
I was using port 8070 when starting the FitNesse. I was using Lubuntu 12.04, PHP 5.3 and Java 1.7 (OpenJDK 7).
Would you all telling me how to solve this problem?
Thank you.
Everyone, I have found the answer for this problem. So I was actually asked this question in the GitHub page of PhpSlim. Mr. Gramlich is the one who answered this problem. You can see the detail here.
I can successfully run the MyFirstSlimTest from Mr. Gramlich's tutorial in my PhpSlim now.
I only need to change the java command from
java -jar fitnesse-standalone.jar -e 0 -p 8070 -d /path/to/project
to
java -Dslim.port=0 -jar fitnesse-standalone.jar -e 0 -p 8070 -d /path/to/project