i am following the tutorial and symfony is not working for routes other than /. I am using a xampp stack to serve html and get a 404 error in the logs. i tried putting the route in routes.yaml and using annotations #Route("/brand/new", name="brand_new").what else should I try?
You are probably missing a .htaccess file which redirects requests to the index.php front controller.
You can install a recommended version of it through a flex recipe:
composer require symfony/apache-pack
Further information: https://symfony.com/doc/current/setup/web_server_configuration.html
i found the answer at Command composer require symfony/apache-pack doesn't create .htaccess file
first do composer remove... then composer require...
Related
I'm beginner, I use Symfony / Composer / MAMP and api-platiform
I have create a new projet in the htdocs folder with the command "composer create-project"
I install api-platform with the command "composer req api"
I good have the file api_platform.yaml api_platform.yaml
But i cant access to /api route on my project
I try different URL like : localhost/project/public/api, localhost/api, localhost/project/api, nothing work
Sorry for my english
Thanks to helping me
It looks like you're missing the .htaccess file. When using Apache you should install the apache-pack with this...
composer require symfony/apache-pack
This will add the .htaccess file to your public folder for the correct rewrite rules as explained in the docs here.
Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET http://task-demi.herokuapp.com/api/register": Method Not Allowed (Allow: POST)" at /app/vendor/symfony/http-kernel/EventListener/RouterListener.php line 140
So I have uploaded my Symfony 5 in heroku.
It is working well in localhost,no error ,but after hosting in Heroku I get above error.
I have used SqlLite
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
doctrine_heroku.yaml
doctrine:
dbal:
driver: 'pdo_sqlite'
server_version: '3.15'
How to resolve this?
Did you install symfony/apache-pack. It allows you to access any URL on your application without having to include /index.php in the path.
In order to quickly enable rewriting for the Apache web server, you can install the symfony/apache-pack recipe, which places a suitable .htaccess file into your public/ directory:
composer require symfony/apache-pack
git add composer.json composer.lock symfony.lock public/.htaccess
git commit -m "apache-pack"
Source : Heroku
I am developing a Symfony2 web app that will be hosted on an Ubuntu server and want my directory structure to be:
/Symfony (with an app,bin and vendor folder in it)
/Site1
/Site2
This way site1 and site2 use the same Symfony framework. In /Site1 I want:
/web
and in there I want app.php and app_dev.php as well as /web/AppBundle with all of the bundle files. I already figured out that I need to change in app.php require_once DIR.'/../Symfony/app/AppKernel.php'; in 2 places as per http://symfony.com/doc/current/cookbook/configuration/override_dir_structure.html
When I generated the bundle I did get the message "Checking that the bundle is autoloaded: FAILED" and that I should "Edit the composer.json file and register the bundle namespace in the "autoload" section"
I added "AppBundle": "/web/AppBundle" to the composer.json autoload section and in cygwin I run "composer -n install" It starts with saying that it is loading composer repositories and then it says "Installing dependencies (including require-dev)" and never goes past that.
What can I do to register this bundle that is not in the standard folder so that autoload picks it up? I am just getting the fact that the class could not be found in AppKernel.php
Thanks.
It's simple. Just don't do it! Use symfony as it is intended with its default directory structure.
Great two projects. If you have common code, extract it to an extra bundle and install it in both projects via composer.
I've dumped assets using the folling command:
php app/console assetic:dump
I've got a Runtime exception:
The source file "c:\EasyPHP\data\localweb\projects\symfony\src\LV\IndexBundle/Resources/public/images/" does not exist.
It seems to me strange that:
the / goes to \Resources only, after it is /
the directory images does exist in public
no CSS work. I even tried internal CSS in layout.html.twig. Nothing changes.
OS: Windows 10
Try to remove vendors and re composer install, clear cache directory.
If problem isn't solved after that, please share your config.yml here
Currently I have a single drupal site installed on apache 2.2 with php 5.3 on RHEL 6. I am moving servers and am trying to migrate the site. I have imported the database and htaccess, but I cannot access any of the pages other than the root of the site.
You may need to disable clean URLs before exporting the database, try to add ?q= before each path.
That happens when:
a) Apache mod_rewrite is not enabled. If you have root access then do sudo a2enmod rewrite
or
b) .htaccess file at the root folder isn't there, so you need to copy it again.
Here's a troubleshoot check list for mod_rewrite issues:
Make sure Apache's rewrite module is enabled: sudo a2enmod rewrite.
Make sure original .htaccess file is there in the root of your Drupal installation.
Make sure that the existing .htaccess file is getting read by Apache. To test it, add a this line in the beginning of the file and you should get a 500 Internal Server Error: ThisIsReallyABadSyntax.
If the .htaccess file is not in effect, make sure that the AllowOverride directive in the main Apache config file (usually /etc/apache2/httpd.conf on debian-based distros) is set to All. It might be set to None by default.
Finally, make sure that the clean URLs feature is enabled in Drupal settings.
With the phpinfo(); compare all the server specs, just to be sure both server are quite the same or similar.
Steps to migrate Drupal correctly:
Go to Configuration
find Clean URLs
Disable tick inside!
Clean cache!
Download your site file
Download your database
Create new database in your new site
Transfer file and database
Log in
10.Do this step to enable Clean URLs:
It's work 100% guaranteed !
Steps:
1. Download - Dev version (7.x-dev)
2. Find file .htaccess
3. just copy it to your server
4. That's it !