Copying Assets to Web root folder instead of Web/Bundles - php

I have Symfony project in which i want to copy images to web folder. So I used bellow command.
php app/console assets:install web
It copy all images to Web/bundles/framework. I want all images in Web root folder.
Please suggest me how can i change the path to store all images or assets to root folder of web instead of storing in bundles.

You cannot do that, because the default bundles/ directory is hardcoded in the source code:
Symfony\Bundle\FrameworkBundle\Command\AssetsInstallCommand - Line 83
$bundlesDir = $targetArg.'/bundles/';
So I suggest either sticking to that convention or submitting a PR to the Symfony core repository to parametrize this directory.

Related

Laravel vue js deploy application on live

I have created a project on laravel using vue js. Where my frontend is totally based on vue js and i am using laravel apis for backend. My project structure is like :
--app
--bootstrap
--config
--database
--fontend //This is my vue js code
-- assets
-- layout
-- mode_modules
-- pages
-- public
-- resources
... and so on.
I have run this command on my frontend folder
npm run build
It created a folder dist in frontend, now what will be the next step ?
My Server Information Ubuntu (Apache)
You should just copy contents of dist folder on your server main folder, or of you have folder structure with folders like public/www/web, then there.
If you want to run "live" on wamp or xamp then copy to folder www.
Of course if you already have working backend
You just copy contents inside the dist folder from your xampp/wampp folder.
and on Ubuntu server place inside directory /var/www/html folder.
or if you want to place inside any folder on the server like /var/www/html/front
then on front folder place contents inside front folder then point domain to that front fodler.

How to upload laravel 5.5 project to cpanel in addon domain

This is Bablu Ahmed. I want to upload my laravel 5.5 project into cpanel and my domain is an addon domain name is w3public.com and it's root directory is not inside the public_html it is outside the public_html (www.w3public.com). I have separated the project's files into two directories, one is www.w3public.com and another is laravel and I moved public folder's files into www.w3public.com and all other files into the laravel folder in cpanel that is given in screenshot below. I have also modified the index.php file of www.w3public.com as follows:
require __DIR__.'/../../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';
But it is not working. Can anyone help me with appropriate solutions?
Screenshot:
Your application should be installed in www.w3public.com and then change the root path from cpanel domains to the public folder inside laravel.
The best way to transfer files is git or the likes, but if they don't have it (usually is the case in shared hosting), you should use a ftp client, and if they don't allow that either, you can upload files/folders from cpanel (way too slow sadly).
If you use git be careful since by default vendor folder is in the .gitignore (you have to run "composer update --no-dev" after all the files are transferred)
Make sure also that your ".env" (usually in .gitignore too, so you prob have to make one) file have your server database info.

images not found assetics load - symfony2

I have cloned a Symfony2 project on my local machine.
I got it up and running but assets in my web/Resources folder won't load (be it images or json files).
I have noticed that after running assetic:dump the css and js files are placed into the web folder and can be accessed from my app at:
localhost:8000/localFolder/web/app_dev.php/css/725c7d7_inuit.min_1.css?version=4.22
I have tried to place my images in the web folder and in the web/Resources/public/images folder as suggested in the Symfony good practices. However when I try to access my image with this link:
​
http://localhost:8000/localFolder/web/Resources/public/images/phone-service/on-the-clock.jpg
it doesn't work.
Any idea ?
You should add your images file (same for css file and javascript file) in
Resources/public/images( same for css : Resources/public/css, js files: Resources/public/js) under your bundle.
Like this:
AppBundle/Resources/public/images
And run this command to generate resources in your web folder
php app/console assets:install
Note that you should run this command line after every modification in your public folder.
if you don't want to make this every time and attribute --symlink
php app/console assets:install --symlink

Affect on security of Laravel 5 when change folder structure to remove public folder

I'm new in Laravel 5.
I found this Laravel 5 - Remove public from URL on Stack Overflow to remove public folder from my Laravel 5 App. Only I have a question about the security.
When I am removing public from URL, then I have to change the basic folder structure of Laravel 5. Yes, it's working fine without the public from the URL.
But what's about the security of Laravel, because I am changing the default folder structure? Is it secure to use?
You should be pointing your Apache host root to the $LARAVEL_PATH/public directory instead of $LARAVEL_PATH.
The point of having sub directory for www host root instead of project root is that you're not leaking any of your project files through your web server.
Even though all the PHP files have the file suffix .php, malicious user can access your $LARAVEL_PATH/storagedirectory and its subdirectory contents, read your composer.json or package.json to find vulnerable dependencies or read .env file etc.
If you're running on shared hosting and you have mandatory public_html, try installing Laravel outside of that public_html directory and either removing public_html (if empty) and replace it with symlink to $LARAVEL_PATH/public OR if you want the Laravel instance to be subdirectory ofpublic_html, do the same but create symlink from$LARAVEL_PATH/publictopublic_html/$PROJECT_SUBDIR`.
That public directory is there for reason to make project a bit more secure. Solve the actual problem and don't try to break this simple but nice security addition. :)
you this link you provided is not about changing the actual file structure of the framework, this example uses mod_rewrite to rewrite the url of your application. In other words you are telling your server that you would like to point to that directory without the full path is visible to the end user.
Also take a look on the below answers of the link you've provided.
Rename the server.php in the your Laravel root folder to index.php and
copy the .htaccess file from /public directory to your Laravel root
folder. -- Thats it !! :)

Setup Projects with CakePHP

If you setup your document root as C:\xampp\htdocs\ and you create a project folder named "ProjectX" where you include all your project files and folders and subfolders, how are you going to make your project runnable with url "http://localhost/projectx" ? I would like to learn how your config and routes files you included in your projects are changed ?
you can refer below link
http://book.cakephp.org/1.3/en/view/912/Installation
cheers
I would not run them as "localhost".
If you link css/js/img absolute to the / root, you will run into problems later on your life server.
it is always best to use virtual hosts and simulate the "real life" on your system:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
You can create a folder projectx in C:\xampp\htdocs\
Then copy all the CakePHP files in C:\xampp\htdocs\projectx\ (including .htaccess, app\, lib\ and all. Setup the salt, cypher, db files and you should be able to access it through http://localhost/projectx/

Categories