Hello I have trouble by deploying my Symfony Projekt to my hoster.
I use: Symfony 2.8 with php 7.1.6
I do the following steps :
1. made a "composer update" on the project
2. cleaning the cache: "php app/console cache:clear -e prod"
3. Upload the files to the hoster
I copy the structure like on my system:
- htdocs-Folder
- app
- bin
- src
- vendor
- test
- web
When I open the website with: www.mydomaine.com/web/app_dev.php I get the following message:
screenshort - error message
Have anyone an idea why ?
THX
It was necessary to delete (make empty) the "prod"-cache folder manually, the command to clear the cache was not enough.
Related
I just installed Symfony's cli on Debian via wget, when creating a new project with the new Symfony project --full, the following error appears:
Executing script cache: delete [KO] [KO] Script cache: delete
returned with error code 1 !! Could not open input file: ./bin/console
!!
Script # auto-scripts was called via post-update-cmd unable to execute / usr / local / bin / composer create-project
symfony / website-skeleton / home / dwes / project Final: exit status 1
Composer generates the directory structure except bin, I try to ignore the error but obviously when I use any php bin/console command I can't open it:
root # dwes2daw: / home / dwes / project Final php bin / console make:
controller Could not open input file: bin / console
Thanks for your time
It was a problem with https://github.com/symfony/recipes. They have fixed it and now you can create your project.
I thought this PR fixed the issue I am having - but I have this patch and it's still not working as I expected - what am I missing or mis-understanding?
https://github.com/symfony/symfony/pull/28533
I have created a .env.test with the following:
DATABASE_URL_TEST=mysql://apps:#localhost:3306/mydb_test
Then I dropped a doctrine.yaml inside the config/packages/test directory.
Symfony v4.2.3
However when I run this command from CLI:
APP_ENV=test bin/console doctrine:database:create --env=test
I am getting an error:
Environment variable not found: "DATABASE_URL_TEST".
Clearly the .env.test file is not being loaded - how do I get a specific environment configuration file to load - other than .env???
If indeed your application was a Symfony 3.x application at some point, what I would guess is that, during the upgrade process, those two lines out of the UPGRADE procedure were missed:
Then, upgrade the contents of your console script and your front
controller:
bin/console:
https://github.com/symfony/recipes/blob/master/symfony/console/3.3/bin/console
public/index.php:
https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/public/index.php
Indeed, it seems like bin/console have been changed recently to reflect the adaptation done on the DotEnv component: https://github.com/symfony/recipes/commit/3e471cbc7d359b3ab245f3b0748d698e8d29692c#diff-2af50efd729ff8e61dcbd936cf2b114b
Mind that you'll also need https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/4.2/config/bootstrap.php
I had a very similar problem. My issue was that my phpunit.xml.dist was pointing to the wrong bootstrap file:
Previously:
bootstrap="vendor/autoload.php"
Changed to:
bootstrap="tests/bootstrap.php"
I'm trying to set up Symfony 2.5 via Composer.
First I am calling:
php5.3.8-cli /kunden/81425/composer.phar create-project symfony/framework-standard-edition hhcadm/ "2.5.*"
This works until at some point it is internally not calling php5.3.8-cli anymore but somehow uses php. The problem is that php is version 4.4.9 and this causes following effect:
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file
X-Powered-By: PHP/4.4.9
Content-type: text/html
<br />
<b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in <b>/kunden/81425/hhcadm/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php</b> on line <b>13</b><br />
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when generating the bootstrap file.
The error makes sense as 4.4.9 is too old. How can I tell Composer/Symfony installer which php installation to use during the install routine?
Same happens for me when I call:
php5.3.8-cli /kunden/81425/composer.phar install
I am pretty shure there must be a config / param for that but I can't find it for hours now.
Thank you very much.
'php' must be the PHP5 executable.
The only solution i see is to modify the PATH, launch the composer command (and eventually restore the old path)
For example :
OLDPATH=$PATH
PATH=/usr/local/php5/bin:$PATH
php /kunden/81425/composer.phar install
PATH=$OLDPATH
To help you, you can also create a small script 'composer.sh' :
#!/bin/sh
OLDPATH=$PATH
PATH=/usr/local/php5/bin:$PATH
php /kunden/81425/composer.phar $*
PATH=$OLDPATH
And you call 'composer.sh install'
Edit : if all php binaries are in the same, you can create symbolic links
For example :
mkdir /usr/local/bin/php5
ln -s /usr/local/bin/php53-cli /usr/local/bin/php5/php
And so PATH=$PATH:/usr/local/bin/php5:$PATH
Edit: If you are not allowed to create /usr/local/bin/php5 then just use any other folder like:
#!/bin/sh
OLDPATH=$PATH
PATH=/kunden/81425/php5:$PATH
php /kunden/81425/composer.phar $*
PATH=$OLDPATH
I installed FOS Userbundle to learn from it, but decided I didn't need it anymore. I then did the following to remove it. After removing, I ran composer update.
removed the bundle from the vendor folder
removed from the appKernel
removed from the composer.json file
removed the entity User.php file
removed the settings from config.yml, security.yml, routing.yml
Now when I attempt to clear cache for production mode I get the following error below. Clearing cache in dev mode works fine.
Can show me what I am doing wrong or what I am missing to remove FOS User Bundle and be able to clear cache in production mode?
PHP Fatal error: Class 'FOS\UserBundle\EventListener\LastLoginListener' not found in /var/www/html/HealthFitness/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php on line 142
PHP Stack trace:
PHP 1. {main}() /var/www/html/HealthFitness/app/console:0
PHP 2. Symfony\Component\Console\Application->run() /var/www/html/HealthFitness/app/console:27
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/html/HealthFitness/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
PHP 4. Symfony\Component\DependencyInjection\Container->get() /var/www/html/HealthFitness/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:86
PHP 5. appProdProjectContainer->getEventDispatcherService() /var/www/html/HealthFitness/app/bootstrap.php.cache:2037
PHP 6. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->addSubscriberService() /var/www/html/HealthFitness/app/cache/prod/appProdProjectContainer.php:343
Your error indeed probably come from a cache error.
Have you this error executing php app/console cache:clear --env=prod ?
You can else delete app/cache/prod/* manually.
In case you can't remove the files manually this should work as well.
You could also use a --no-warmup and --no-optional-warmers switches:
cache:clear --no-warmup --no-optional-warmers --env=prod
that way it should not try to recreate the cache of non existing classes and then do a
cache:warmup --env=prod
Manually removing cache is faster though, but you still warm it up.
symfony/symfony v2.2.0
monolog/monolog v1.4.1
After running composer.phar update yesterday, monolog was updated; running the same command today results in the following error message:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
[ErrorException]
Warning: constant(): Couldn't find constant Monolog\Logger::DEBUG in [path]\vendor\symfony\monolog-bundle\Symfony\Bundle\MonologBundle\DependencyInjection\MonologExtension.php line 109
The (i think) relevant part of config_dev.yml
monolog:
handlers:
main:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
firephp:
type: firephp
level: info
Did something change that requires additional configuration, or is something else happening ?
Monolog recently switch to PSR-4 compatible autoloading. Possibly, the
version of Composer you're running is too old for that. Please run
composer self-update first and try to update your dependencies again.
Sounds like the update didn't go well - do you have a Logger class in vendor/monolog/monolog/src/Monolog/Logger.php? If not I would suggest deleting the vendor/monolog dir and running composer install to get it back.
I had this same thing, but for Laravel.
I solved it by creating the app/storage folder and all it's sub-folders and files.
I get them by creating a new empty project, and just a copy-paste !
Woking now...
Here is the file structure:
app/storage/cache
app/storage/logs
app/storage/meta
app/storage/sessions
app/storage/views
You can ignore this folder for your repository.