Deployment of symfony project? - symfony

After uploading my symfony2 project to the server, I try to reload :
http://my_website.com/web/app_dev.php and it show me this error :
Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry'
not found in /my_path/app/autoload.php on line 11

A missing class can indicate that the dependencies are missing. You have to install them with Composer:
composer install
And you can adjust options:
--prefer-dist: download zip files instead of using git repositories
-vvv --profile: display more verbose output
Which gives:
composer install --prefer-dist -vvv --profile

Related

Can't create a new Symfony project

I can't create a new Symfony project as described in the Symfony Documentation: https://symfony.com/doc/4.3/setup.html
This is the command I use: symfony new --full my_project
Output:
$ symfony new --full my_project
WARNING The current directory seems configured for as a SymfonyCloud project, but it is not linked yet.
You can link this directory to an existing project: symfony link [project-id] (get project IDs via symfony projects)
* Creating a new Symfony project with Composer
unable to find composer, get it at https://getcomposer.org/download/: exec: "composer": executable file not found in
$PATH
I don't understand why the command can't find the composer executable.
When I just enter $ composer in my terminal, composer is executed.
This is my Symfony CLI version: Symfony CLI version v4.6.1
In my .bash_profile file, I have an alias for composer:
alias composer="php /usr/local/bin/composer.phar"
My /etc/paths:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
What is wrong in my config?
Most likely, it's because you didn't rename composer.phar.
First, do this:
mv /usr/local/bin/composer.phar /usr/local/bin/composer
It will rename composer.phar to composer.
Then you can also delete your alias.
Alias are for connected users. Executable and installer don't read your aliases, which is why symfony installer isn't finding composer.
If it doesn't solve your problem, you can try to install your Symfony project with composer directly:
composer create-project symfony/website-skeleton my_project
You can also check what php version is that your symfony is using
In my case it was linked to php 5 and by changing to php 7 problem has been resolved
To check php version linked use :
symfony local:php:list
And then to edit your php version create a .php-version file then write the version that you want to use

error when installing php unit

I'm working on an existing symfony project and need to use php unit.
When I tried to install it through composer with this command:
composer require --dev phpunit/phpunit ^5
But I got this error:
proc_open (): CreateProcess failed, error code -267
See screenshot here
If you refer to MS's error code reference, you'll see that error code 267 means that the directory name is invalid. So you've probably got an invalid directory reference in your configuration file.
Symfony has its own PHPunit bridge component that adds features on top of the library.
Install it by running this command at the root of your project:
composer require --dev symfony/phpunit-bridge
You should then be able to run your test scripts with:
./vendor/bin/simple-phpunit

unable composer install of symfony2

Composer is working fine (checked the "php composer.phar" command)
However upon trying to install symfony2 by pasting the exakt command from their site, I only get an error like this:
Mattias-MacBook-Air:temp acr$ composer create-project symfony/framework-standard-edition /Users/acr/Documents/www/ "2.3.*"
-bash: composer: command not found
-bash: composer: command not found
Do I have to configure my OSX in a certain way for this to work?
If so, is my machine messed up, since that isn't covered in the walkthrough, so I assume other people won't have to?

Composer update error while trying to install ccdn-forum-bundle Symfony2

first of all I would like to say that I'm relatively new to symfony and I work with Netbeans.
My first problem occurs when I'm trying to install ccdn-forum-bundle like it's said here:
https://github.com/codeconsortium/CCDNForumForumBundle/blob/master/Resources/doc/install.md
When I try to update-dev with composer I get this error:
[RuntimeException]
Failed to execute git status --porcelain --untracked-files=no
"git" is not recognized as an internal or external command, operable program or batch file.
It occurs when composer is trying to update friendsofsymfony/user-bundle and when I try to run my project I get this error from symfony:
ClassNotFoundException: Attempted to load class "MonologBundle" from namespace "Symfony\Bundle\MonologBundle" in C:\xampp\htdocs\PortalInternoHUPR\app\AppKernel.php line 14. Do you need to "use" it from another namespace?
I tryed to fix it by running install dev in composer, but then I get this other one:
Fatal error: Class 'Knp\Bundle\PaginatorBundle\KnpPaginatorBundle' not found in C:\xampp\htdocs\MyProject\app\AppKernel.php on line 23
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command.
Thanks.
Try not to use netbeans, and install the bundle directly from the prompt
First check if git is correctly installed
git –version
Then run
php composer.phar update
If that didn’t work for you, I suggest making a fresh install using --prefer-dist option
php composer.phar install --prefer-dist

Symfony 2 -> Composer and CloudControl

I have a little problem to setup Symfony 2 on Cloudcontrol,
I followed the instructions and installed a Symfony 2 framework, changed the document root and so on.
Now when I try to push the changes to server server, it loads the dependencies from the composer.json and then it failed with a message :
[RuntimeException]
Could not scan for classes inside "/srv/tmp/builddir/code/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs" which does not appear to be a file nor a folder
This file is a vendor package, loaded from composer.
I have the same effect with a default composer.json file from a sample project (SF2)
Localy it works very well!
Can some one give me a hint ?
Got same error after setting "minimum-stability":"dev" and running composer update.
for unknown reason symfony/symfony (dev-master ...) kept failing to download from source thus was being loaded from cache.
what worked for me was a mix of previous answers:
$ rm -rf vendor/symfony
$ composer clearcache
$ composer install
Sometimes I had to clean composer cache to remove strange errors, usually it's in
/home/user/.composer/cache
You can also try to update composer with
php composer.phar self-update
I hope it runs for you.
I had the exact same error in my development directory.
What fixed it was :
$ rm -rf vendor/symfony
$ php composer.phar install
It reinstalled symfony/symfony, symfony/icu, symfony/assetic-bundle, symfony/monolog-bundle and symfony/swiftmailer-bundle and now everything works !

Resources