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.
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 have a project with Laravel version 7.28. I run
composer require barryvdh/laravel-debugbar --dev,
After that I added Barryvdh\Debugbar\ServiceProvider::class to app/config.php under providers and added
'Debugbar' => Barryvdh\Debugbar\Facade::class
to app/config.php under aliases. Then I run
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
Even though APP_DEBUG in .env is true and I terminated and rerun the app debugbar is not showing. Where did I make my mistake?
I checked the config/debugbar.php, I see the new key DEBUGBAR_ENABLED with default is false. Then add it to .env file: DEBUGBAR_ENABLED=true
Make sure you are running on right port. I had php backend (running on port 8000) and react frontend (running on port 3000) and I did everything you have described above but it never worked. The issue I had was that I was checking if the debugbar showed up on port 3000 (which it never did sadly). I went to check on port 8000 and the debugbar was sitting there the whole time.
I didn't end up using the php debugbar because I think it only works if your frontend code is written in php (though not 100% sure).
I ended up debugging using postman. It doesn't have all the functionalities that the debugbar offers but it is a great tool to use if you just want to do basic debugging.
I'm completly new to Symfony and tried the following guide: https://github.com/thecodingmachine/symfony-vuejs ... but without docker (I have a simple webspace, I can't use docker there).
Now I'm stuck right in the beginning, when calling composer install in the app root. I get the following message:
In EnvVarProcessor.php line 131:
Environment variable not found: "DATABASE_URL".
Well, that sounds easy, I have to setup an enviroment variable ... but I'm not using docker and I don't want to set up a temporarly variable in the shell. Few seconds of google helped me, that I can use .env for my problem like descriped here: https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables
In the example project is already a .env file, so I extendet it by DATABASE_URL. But suddenly it is not taking that variable.
I'm working on a macbook with a simple apache/php setup without forther configuration.
What am I missing?
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.
I need to move app in laravel from web server to local sever (I trying on XAMPP). I moved all files, database and in files I changed URI in:
/index.php
<? header("Location: http://localhost/public"); ?>
but I get errors in:
On http://localhost/ I have blank page
On http://localhost/public and every another route I getting error: http://pastebin.com/zUFqS8ET
When I use php artisan or another commands I getting error:
[ErrorException]
Undefined index: HTTP_USER_AGENT
I forgot about somethink?
EDIT:
Ok, I downgrade my PHP to 5.6.* but artisan still not working - same error, what's the problem?
EDIT 2:
Here is logs - problem is in SMF but I don't know why ...
http://pastebin.com/HZQ7CZeg
Sorry, I know this is obvious. But, have you run PHP composer install? And as a basic test you can create an empty laravel project to test your computer's configuration. If it works then you know its something in your project you need to update.
Laravel installation