Symfony 4 app running on Google App Eng (flex).
I deployed the app, but I am getting a 500 error, and app engine is providing no additional detail.
The deploy process I did was as follows:
(Following doc https://cloud.google.com/community/tutorials/run-symfony-on-appengine-flexible)
Include an app.yaml file as follows:
runtime: php
env: flex
runtime_config:
document_root: public
front_controller_file: index.php
env_variables:
APP_ENV: "prod"
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
Update the composer line:
"post-install-cmd": [
"chmod -R ug+w $APP_DIR/var"
],
Cleared cache and warmed cache for production:
php bin/console cache:clear --env=prod --no-debug
php bin/console cache:warmup --env=prod --no-debug
Even though I haven't done the doctrine set up part, I should be able to go to xxxx.appspot.com and get the home page. Instead I get ...
xxxx.appspot.com is currently unable to handle this request. HTTP ERROR 500
This is puzzling because the app worked totally fine locally before warming the cache.
Am I deploying correctly or forgetting something? (I cant get any detail on error from App Engine).
Edit
I have checked the var/log local folder and found dev.log and prod.deprecations.log. In the latter I have this error many times ...
[2018-10-15 11:28:59] php.INFO: User Deprecated: Referencing controllers with a single colon is deprecated since Symfony 4.1, use "fos_user.security.controller::loginAction" instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Referencing controllers with a single colon is deprecated since Symfony 4.1, use \"fos_user.security.controller::loginAction\" instead. at C:\\dev\\projects\\jw-app\\vendor\\symfony\\framework-bundle\\Routing\\DelegatingLoader.php:98)"}
Based on the new edit information you’ve just provided it seems that the issue you are encountering is more on the Symfony version you are using than GAE.
Symfony 4.1 has deprecated the bundle notation. This means that it is no longer recommended to organize your business logic using bundles. You can see some examples of this on the official Symfony web page here.
Your error message tells you to use the following:
\"fos_user.security.controller::loginAction\
For the file at path:
C:\dev\projects\jw-app\vendor\symfony\framework-bundle\Routing\DelegatingLoader.php:98)
on line 98
It seems a few people have the following referencing issues with Symfony 4.1 as well. You can view the details of their similar issue and review recommended fixes at FriendsOfSymfony Github page.
Also, I would like to mention that since you are using GAE:Flex you can view your build history and error logs for your project at the following:
Google Cloud Build ( Google Cloud Console > Open the menu > tools > Cloud Build )
This will provide you the necessary information of the build you are trying to deploy on GAE.
Related
I am trying to create a simple symfony project.
I run this on console:
composer create-project symfony/skeleton myProjectName
php -S 127.0.0.1:8000 -t myProjectName/public
Project succesfully run at localhost:8000. However, when I begin to inspect the code, I realized VS Code editor is indicating "Undefined type" error in projectDirectory/src/Kernel.php file. Do you have any ideas why this happens and any suggestions towards solution?
I use PHP v7.4.32 and Symfony 5.4 for development. My helper extentions are PHP Intelephense v1.8.2 and PHP IntelliSense v1.0.11.
projectDirectory/src/Kernel.php
The Error
Since it runs succesfully on browser, I dubted that the classes exist somewhere but the VSCode could not solve the relative paths. Then, I tried a couple of extensions. Installation of PHP v1.22.11089 created by DEVSENSE and PHP Namespace Resolver v1.1.9 created by Mehedi Hassan has solved the problem.
I created a new project using Symfony 5.1.2, then I tried to run the server using
symfony serve. Once I tried to access localhost:8000, I had this warning in the terminal : [Web Server/PHP ] Jun 22 13:47:55 |WARN | SERVER GET (404) / ip="::1".
Moreover, the page I had was symfony's default page saying "#Page not found".
I checked the existing routes and I had default ANY ANY ANY /.
I also checked the DefaultController, but everything looks fine, since it is the auto generated controller...
I don't know what else to check, how could I get this default page working ?
I had a similar issue : I had run symfony server:start and was even seeing it react to my entering HTTP addresses in the browser, but I kept having that "# Page not found" message.
Quite simply, my symfony project was in Group/SubGroup/Project... and I was running symfony server:start from Group/SubGroup. When I stopped Symfony and ran it again from Group/SubGroup/Project, it worked like a charm.
A beginner's mistake, to be sure, but beginners use this site too.
Did you run the symfony project? It will show if you didn't run the symfony project. Run the project from terminal.
cd my-project/
symfony server:start
ip="::1" is the localhost on windows and wsl 2. Symfony server listen on 127.0.0.1:8000.
You must edit the windows hosts file at C:\Windows\System32\drivers\etc\hosts.
Add this line : 127.0.0.1:8000 localhost:8000
It works for me.
I am new in symfony framework. Getting the below error when download the full project in localhost but it works in server.
Fatal error: Class 'Symfony\Bridge\Doctrine\ManagerRegistry' not found
in D:\wamp\www\DOFE\edin\vendor\doctrine\doctrine-bundle\Registry.php
on line 28
Thanks in advance.
You probably want to execute composer dump-autoload to force composer to regenerate the autoload namespaces for your app.
Regarding your comment, if you are getting this message it means you are in prod and you should switch to the dev environment to have details about the error (access to the symfony profiler).
Just add app_dev.php after the host in the url.
Hi there,
I am facing a quite annoying issue.
Situation
I would like to deploy symfony2 application in production on mutualized servers of OVH (pro). I got shell access (ssh), my database works fine and my files are online.
Issue
I cannot manage to make any php command line work. That is, for all major commandline:
- updating web directory : php app/console assets:install web
- updating databases: php app/console doctrine:schema:update --force
- downloading composer: php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"
-etc...
I get parse errors such as:
syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in
or
Error in argument 1, char 2: option not found r (that one was for composer download)
it seems a pretty common pb, however I couldn't manage to fix it :/
Any hints welcome!
Thanks in advance,
Cheers
On ovh, you can choose witch php is used by altering the cmd line :
/usr/local/bin/php.ORIG.5_4 -> php.ORIG.5.4.6
/usr/local/bin/php.ORIG.5_3 -> php.ORIG.5.3.16
/usr/local/bin/php.ORIG.5_2 -> php.ORIG.5.2.17
/usr/local/bin/php -> php.ORIG.4
I had a simular problem with deploying symfony2 project. I`m not sure that this is the case here, but my problem was with the cache. For some of the symfony2 console commands it uses cached paths, and if you have changed the location of the project this could cause the problem. It uses a cached path when trying to delete the cache :D so my suggestion is to go and delete manually the cache i app/cache.
Hope i helped
I am migrating my app to Symfony 2.1 but I'm facing a big error. I've got a command which calls the templating service to render a twig template. The code +- is:
$content = $this->getContainer()->get('templating')->render('XBundle:Pdf:x.pdf.twig', array(
'variablea' => '',
'variableb' => ''
));
It was working without any problem in Symfony 2.0.X. But after migrating into Symfony 2.1, when that piece of code is called, an exception occurs:
Fatal error: Call to undefined method Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator::isFresh() in /vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/Factory/Resource/FileResource.php on line 49
I've reported that in symfony/asseticbundle tracker on github like 14 days ago and nobody answers, which makes me think that I am the problem here... (https://github.com/symfony/AsseticBundle/issues/122)
What am I doing wrong?
Thanks!!
Did you clear the cache (php app/console cache:clear) and also rebuilt the bootstrap file?
Here are a few suggestions:
Check if you are using proper versions of the Symfony bundles. Compare the bundles versions in your composer.json file with versions in the default Symfony 2.1 distribution: https://github.com/symfony/symfony-standard/blob/v2.1.2/composer.json
Make sure your Symfony 2.1 installation is not still using Symfony 2.0 cache files. If you are not sure about this delete the cache folder content. In your project root directory do rm -rf app/cache/* and set up appropiate permissions as explained in the documentation: http://symfony.com/doc/current/book/installation.html#configuration-and-setup