I want to run a directory/folder located on the root of server same place where other laravel file are located. but when I put url like www.example.com/mobile/functions.php its not working, in return laravel's route not found message received.
My Directory Structure is
-\Root
- app
- config
- database
- mobile
> - db.php
> - index.php
> - +functions.php
- *public
- resources
- route
- storage
- tests
- vendor
I want to run that mobile folder as www.example.com/mobile.
Anyone Help me
Thanks
place it in public folder or same folder with your index.php
Related
I decide to use Laravel on my existing blog - let's say - example.com
All of my files and folders are inside public_html folder
I installed Laravel using Softaculous on cPanel
Firstly I tried to install it inside public_html - but get a warning - index.php already exists
So I choose public_html/lar/ as destination
and now - how can I use the framework on my site ?
for example on my home page (index.php) I have an ajax call to index.pro.php
let's say - index.pro.php need to send an email
how can I use Laravel engine for that task ?
it is installed completelly on a differrent folder - i.e. subfolder - public_html/lar/ ?
You need to edit your .htaccess file on cPanel
DirectoryIndex public_html/lar/public/index.php
Issue: Assets retrieving issue in Laravel 5.4
Server root directory
-- public_html/
-- pilardir/ [Laravel Installed Here Project Controller, Models, Views Working from this directory]
Domain setup
www.thepiresearch.com Domain pointing directory (public_html/)
The problem here is the laravel application setup in the [pilardir] directory so when we setting up any assets file or upload blog images from the app then its uploading here pilardir/public/uploads/blogs which is all correct.
Now the problem is when we fetching the assets files / images it return the path and assets url from
public_html/public/uploads/blogs
which is incorrect.
please try this :
www.thepiresearch.com/uploads/blogs
remove public and public_html of public_html/public/uploads/blogs
I am deploying my first project on a shared hosting.
I followed this tutorial to deploy the website and turn the public folder into the public_html folder of my hosting plan.
When I upload an image from my website (with storeAs() method), the file is uploaded in the private/storage folder, not the public one (where I would like).
The asset() function try to display the image from public_html/storage.
What can I do ?
Thank you :)
My files are like this :
private/
- app/
- bootstrap/
- config/
- database/
- resources/
- routes/
- storage/
- tests/
- vendor/
public_html/
- css/
- js/
- images/
- js/
- storage/
(Laravel 8, trying to be hosted on Hostinger)
The tutorial : https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj
Why does this problem happen?
If you implement and need storage matter in your project then you need to link storage folder to the public folder for security reason and to make the URL simple, clean and readable by the users, so when you upload the laravel project to a server, you need to run the following command line to complete the linking process:
php artisan storage:link
and since you host the laravel project to a shared server, so you don’t have access to a terminal to run the above-mentioned command line . so I’ll show you a way to do that manually without using SSH or the terminal.
Steps to fix the problem
1- At localhost server-side (before uploading the project to the server), make sure that you have done filesystem configuration, then run the following command line:
php artisan storage:link
after that you will get a message “The links have been created.” and that is ok for now.
2- Upload the project to the server, the storage link will not work as you expected, so we need to start fixing this.
3- Go to the public folder you will find a folder called “storage”, delete it.
4- Go to routes folder and open “web.php” file, then copy & paste the following code at the top of the file:
Route::get('/linkstorage', function () {
Artisan::call('storage:link') // this will do the command line job
});
Don’t forget to save the changes.
Also, you can do the same process via “api.php” and using requests tools like postman.
5- Now we just need to run this code, so we need to do the GET request by entering the following URL at browser search bar:
“https://www.your-domain.com/public/index.php/linkstorage”
or
“https://www.your-domain.com/public/linkstorage”
this request will run the above code “Artisan::call('storage:link')” which is, in turn, will run the command line
PHP artisan storage: link
now you can go to the public folder and you will see the “storage” folder created again and marked as a shortcut folder and that means the public storage folder now is linked to the storage folder of the project.
6- Now if you upload or create a file to the storage folder, then it will appear in the public/storage folder too, now you can hit the URL of the file at the search bar of the browser and you will get the file successfully :).
Ok guys i found the solution !
Here is how to deploy your Laravel project on one shared hosting using public_html folder : https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj
This will work but you can have a problem (like me) with the storeAs() method if you deal with file uploads.
To solve this problem, I edited the MyProject/config/filesystem.php by adding this in the available disks :
'public_folder' => [
'driver' => 'local',
'root' => 'PATH',
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
]
Replace PATH with the complete path to your public storage (for example /home/you/domains/mydomain.com/public_html/storage/).
Now, open the controller which manage file upload and edit it like this :
request()->image->storeAs('/uploads', 'filename.png', 'public_folder');
This will upload the request()->image in public_html/storage/uploads/filename.png.
I hope it will help you if you had the same problem as me.
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.
I am under the impression that any files placed in the webroot/ folder of a plugin in CakePHP 3 should be served automagically. However, I have not been able to get a file to be served from that folder...
I have created an example project
https://github.com/CakePHPKitchen/CakePHP-Plugin-Webroot-Issue
In the example project, I have baked a plugin named Elite and inside the plugins/Elite/src/webroot I have placed a text file named bingo.txt
To reproduce the issue
Clone the repository above
Execute the command bin/cake server -p 8675
Visit http://localhost:8675/bingo.txt
View Missing Bingo Controller Error
My Question is, how do I retrieve bingo.txt?
Do I have to set a setting somewhere to enable that webroot folder?
Make sure the plugin is loaded in your config/bootstrap.php
Plugin::load('Elite');
Then link to the webroot of the plugin with localhost:8675/elite/bingo.txt