I'm trying to create a new route like this:
#Route("/restaurant/", name="restaurant")
#Route("/work/", name="work")
#return Response
But when I visit /work/symfony in my browser, it returns this message:
Unable to parse file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml": The XML file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml" is not valid.
When I clear the cache with the following command, it works:
php bin/console cache:clear -v
How can I fix this, without need to clear my cache all the time?
I found the solution by starting a symfony server instead of using XAMPP by running : symfony server:start as simple as that ...
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.
Few weeks ago I set up a Message system with Symfony Messenger and it worked great.
Today I wanted to create new object through message, so I went to my server and type the command to consume message
First I had this result
$ bin/console messenger:consume-messages amqp_notifications
/usr/bin/env: ‘php\r’: No such file or directory
It never happened before with my files, and I never changed the line ending or encoding of my file sin PHPstorm.
I tried to use $ php bin/console messenger:consume-messages amqp_notifications
but then I had this error.
Attempted to load class "AMQPConnection" from the global namespace.
Did you forget a "use" statement?
Pretty weird, because I have have the php-amqp ext installed as you can see on the screenshot of my phpinfo
I didn't change anything in my Message class or Handler.
Also, I tried to call new AMQPConnection() on a random action, just to try, and I didn't get the error.
I'm completely lost with this error this time, as everything is installed.
I use PHP 7.3.1 and symfony Messenger 4.2.2
It seems your second issue was already solved by ccKep on his comment.
The first one is that the specific shebang line #!/usr/bin/env php executes the first php found in the $PATH. So if you already have uninstalled it, which seems the case, or it has a symbolic link to another php version, you can get a wrong result.
Tries to check what is inside the $PATH and replace the PHP path for the correct one. You might get the place running which php.
Hello i am trying to add swagger into my laravel project.
installed
composer require "darkaonline/l5-swagger:5.6.*"
so when i do
http://127.0.0.1:8000/api/documentation
got info
Fetch error Not Found http://127.0.0.1:8000/docs/api-docs.json
already created docs folder with that json file.
Should i adjust route or change swagger base URL somewhere, not sure whats the problem. Tnx for your help.
You should run the command
php artisan l5-swagger:generate
after adding the annotations
And if you are still getting the Not Found http://your-host/docs/api-docs.json error.
Run chown www-data storage -R
if you still get "Not Found" error after running the
command : php artisan l5-swagger:generate
run
php artisan route:cache , worked for me
open in incognito in chrome or as a private tab in firefox
this problem for your internet explorer, chrome, FireFox
Back from vacation, and when I'm trying to run one of my previously working command:
php artisan list
Throws me:
[root#api2]# php artisan list
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function getArgument() on a non-object","file":"\/var\/www\/html\/api2.alariscms.com\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php","line":153}}
And I seriously cannot understand why this happens. I tried debugging the file that throws an error. It awaits argument:
InputInterface $input but it gets NULL
I don't know what can go wrong on a framework level to stop receiving the required object.
Any ideas where to start debugging from? Or I can reload configurations / update laravel via cmd?
Thanks
This is what I would do:
php artisan dump
composer dump-autoload
check for current Laravel version
and then go to that specific command and check for bug there.
Also, what kind of argument are you trying to pass to command ? Is that object - if so check where is implementation of that class ?
I'm new to symfony and I am trying to run a simple command on the command line but I get an error message.
When I try to execute the command:
d:\new_xam\xampp\htdocs\sf_sandbox_1_2\sf_sandbox>symfony propel:build-model "
I get the error:
'php.exe' is not recognized as an
internal or external command,operable
program or batch file.
Can anybody help me?
This is a fairly common issue on Windows systems for people new to Symfony and/or PHP. It seems to be an issue with the PHP path. See here: http://forum.symfony-project.org/index.php/m/44895/?srch=php.exe+command#msg_44895
Can you try to use the real path for PHP?
i.e.,
"C:\Program Files\PHP\PHP.exe" symfony propel:build-model
At your Symfony directory.
You should be able to prefix everything with "php".
So instead of symfony propel:build-model you can do php symfony propel:build-model.