My Symfony 3.3 application is looking for app folder in wrong place.
I deployed Symfony 3.3 project to a subdomain (subdomain.domain.com). Subdomain folder location on server is: /home/USERNAME/public_html/PROJECTNAME
Subdomain document root is: /home/USERNAME/public_html/PROJECTNAME/web
This is normal Symfony folder structure, nothing changed. Why it doesn't look for app folder in correct place? What am I missing?
Error I get is:
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Config\Exception\FileLocatorFileNotFoundException: "The file "/home/USERNAME/public_html/app/config/routing.yml" does not exist." at /home/USERNAME/public_html/PROJECTNAME/var/cache/prod/classes.php line 3040 {"exception":"[object] (Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException(code: 0): The file \"/home/USERNAME/public_html/app/config/routing.yml\" does not exist. at /home/USERNAME/public_html/PROJECTNAME/var/cache/prod/classes.php:3040)"} []
EDIT:
I found out that composer.json was not in the correct folder. I posted that as an answer and accepted it.
composer.json file needs to be in the root folder of the app.
The error message gives you the clue, I don't know how you browse your site, but Symfony tries to find the file from your root folder, I guess you are trying to browse as a domain.if it is subdomain then URL should be like this SubDomainFolderName.DomainName
Or try to solve this using .htaccess
You should run bin/console cache:clear command after deploy.
And what about the content of getCacheDir method in AppKernel?
Should be:
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
Related
I have installed and configured Joomla site on one of my domains (in sub folder), and it works great there, so now, I wanted to move it to original domain where it has to be, so in WHM I created new account for new domain, and moved my Joomla files and DB to new account, in config file, I've changed user and DB data, also changed path for log and temp and when I run Joomla on new domain, I get this error:
Fatal error: Class 'JHtml' not found in /home/newsite/public_html/libraries/cms.php on line 12
The line 12 in that file is:
if (!defined('JPATH_PLATFORM'))
but since it works on old domain, that should not be a problem?
Everything stayed on same server and folders and files in root directory have same permissions
I've added this code to index.php, before that I just got blank page
ini_set('display_errors','On'); error_reporting(E_ALL);
I've followed document to re organize files in app/config directory.
Now I have config/common (with config, parameters, parameters.dist, routing, security & services files), and files for each environment in specific directories : app/config/dev and app/config/prod.
But now, when I try to send "composer -n install" to update autoload, I have this error :
[InvalidArgumentException]
The dist file "app/config/parameters.yml.dist" does not exist.
Check your dist-file config or create it.
I know this is a configuration problem, Symfony search my dist file in app/config, how can I redirect it to app/config/common ?
I don't know where is the "dist-file config" written in error.
Thanks!
Found !
It is in composer.json:
under "extra", "incenteev-parameters", I've changed value of "file".
I have integrated the Example module in my Sulu-standard installation. The code I used for the example module is from following repository :
https://github.com/sulu/ExampleNewsBundle
And the steps I followed for integration are from this
http://blog.sulu.io/how-to-develop-a-bundle-in-the-sulu-admin-1
After the installation I am getting this error while loading the JS for the module :
"NetworkError: 404 Not Found - http://beauty_dev.com/en/bundles/examplenews/js/main.js?v=develop"
Error: Script error for: /bundles/examplenews/js/main.js http://requirejs.org/docs/errors.html#scripterror
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
Error: Script error for: /bundles/examplenews/js/main.js http://requirejs.org/docs/errors.html#scripterror
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
After some research I found that 404 error was due to locale(en) appended in the URL.
Is it possible to remove the locale from the URL?
Any reference will be appreciated.
After adding a new bundle you have to reinstall the assets using the following command:
app/console assets:install --symlink
Symfony doesn't do that automatically, so you have to execute this line, in order for the files to be copied to the web directory. You could also check if the accessed file is available in the web directory, which should be the case after executing the above command.
Regarding the language: You see that because Sulu tries to redirect to the default language if the current URL leads to a 404 and doesn't contain a language.
Are you sure that the files in the web/bundles/examplenews folder exists and you can access from the browser? When the files exists and the webserver returns them correctly the /de will not be prepended.
I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
However as I'm using vagrant, the file path of the server doesn't match my host.
I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.
Any ideas?
Thanks
When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:
// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'
Symfony FrameworkBundle Configuration - IDE
The answer given by Jeffry no longer works unfortunately :(. When In configure that with my paths the profiler throws:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
I have configured the path according to this line in the SF docs: This map should be specified at the end of the URL template, which results in this:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
However, it does open PHPStorm, but phpstorm does not open the file, so i'm a bit stuck here now.
This solves the issue with the file not opening in PhpStorm from a Vagrant:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/
Source: https://youtrack.jetbrains.com/issue/IDEA-65879
I've got very simple .WAR containing example servlet. I'm able to deploy it in servicemix using the following command:
osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet
And then see it in my browser. But only with full path to a file, e.g.: localhost:8080/TestServlet/index.html or localhost:8080/TestServlet/TestServlet (my servlet is TestServlet class).
I'd like to launch the index.html page automatically after entering: localhost:8080/TestServlet
how to do it?
MORE IMPORTANT
I need a way to convert the .WAR file or servlet project (I've got the sources) so that new .WAR file can be auto-deployed by copying it to $SERVICEMIX_HOME/deploy directory.
I've tried editing the MANIFEST.MF file, but with no success. Probably I'm doing something wrong.
Thanks for any advice/help.
To be recognised as a wab, you need to add a context path header to your manifest:
Web-ContextPath: TestServlet
It's working now! I was doing my MANIFEST.MF according to this page: http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
The problem was that for some reason "Bundle-Version: 1.0" line was required as opposed to optional as stated on that page.
Honestly, just adding the Bundle-Version fix-it.
I knew it was something wrong with the MANIFEST.MF and after Holly Cummins' question I played with it a bit more. Thanks Holly.
I still can't do anything with the manual site launching (have to manually enter the index.html).
http://localhost:8080/TestServlet/ gives me this:
HTTP ERROR 404
Problem accessing /TestServlet/. Reason:
Not Found
Powered by Jetty://
http://localhost:8080/TestServlet/index.html gives me proper site.