Whenever I try to run
php artisan serve
on my newly created laravel project directory, it always serve the other project from another directory.
I am using homestead virtual box's latest version with vagrant.
If I try to delete/rename the project that is being served, then run php artisan serve on my new project, the browser will show
No input file specified.
Related
I am working on Laravel React project on localhost when I run a command
PHP artisan serve
It is working fine on http://127.0.0.1:8000/
But when I am trying to run it without php artisan serve command and trying to access with
http://localhost/project_name
It is not working. I follow all necessary changes like
Move .htaccess to root folder
server.php to index.php
Not any error just blank page
Server Details:
windows server 2012 R2
Apache server 2.4
As IIS server works 8080 and Apache works on 8181 port
PHP 7.4
Mysql Database
We need to deploy the Laravel project on 8181 port.
We have run the composer successfully. After that save the Laravel project on htdocs of Apache24 folder. In htdocs we created Laravel folder into that we keep all the Laravel project file. so the path is c:/Apache24/htdocs/Laravel/public/index.php
In url it also shows the path like http://ip address:8181/Laravel/public/index.php. It shows the landing page of website. After that when click on register page it shows the register controller name after index.php like below
http://ip address:8181/Laravel/Laravel/public/index.php/register
This shows the extension of file as well as public folder, which is not standard Laravel pratice
You have to use artisan command in terminal or cmd for running laravel project.
php artisan serve
when use this artisan command, laravel runs on port 8000 as default but if you want run project on custom port, you can use port flag in artisan commad
php artisan serve --port=8181
You have to change some configuration
In your public directory all files cut and copy at your Laravel folder. And you have to change some configuration in your index.php file
require __DIR__.'/vendor/autoload.php';
and
$app = require_once __DIR__.'/bootstrap/app.php';
And just url like this
http://ip address/Laravel/
I have issue with Artisan usage on Windows 10 with Xampp.
What have I done:
clone project from git repositiory
run composer install
In directory with project i trying run:
php artisan
but i get errror:
Could not open input file: artisan
But if i run command
php bin/console i get list of command like cache, debug, eloquent... so some tools are there... But none artisan...
How i can add/use artisan into existing project?
Check if artisan file exists in your project root folder. If it does, then you're probably on the wrong folder. If it doesn't exist, you can just download it from the official repo.
To configure an existing project, you'd typically check those things first :
You should goto app/config/database.php check file and verify username and password.
After check in Project Folder vendor folder and composer.json file exist then remove it (that remove old configuration now we going to fresh configuration).
Then after back to command prompt and fire command composer update and that download some dependent file download.
Now Run php artisan serve
I don't have permissions for every file that has been created inside a docker container.
For example,
Inside a php container for a laravel project, executing php artisan make:model SomeModel will create the php file SomeModel.php as root user, so when I try to change or delete it in my OS (Linux mint) I can't because my user has no root permissions.
In Windows it worked without this headache, how to avoid it on Linux mint?
It is most probably because in your docker, you run programs (php artisan in this case) as the root: see the figure, you have root#...:/code/app# showing that.
My suggestion is: in your docker file, you add another user with proper permissions (you may have it done already) and just before running the php artisan command, you change the current user from root to the added user (with su - user command) and then run the command.
I used laravel storage class to upload images in the storage folder. it successfully upload images and I can successfully access them by Storage::url('path'); or Storage::download('path');
however, when I copy the project to another location and try to run my copied project using php artisan serve, I can not access the images! this is while the original project is still fine and images are accessible.
it is noteworthy that I already used php artisan storage:link in the original folder. When I run php artisan storage:link in the copied folder it says it already exists. It is interesting that Storage::url('path') creates the url correctly and images are also copied correctly in the new location.
How can I fix this problem?
will this be a problem if I deploy the project in a web host?
Firstly Remove Storage Link from public folder by running
rm public/storage
And then try to run below command
php artisan storage:link
try to run clear cache and config. may be because of cache settings so try this
php artisan cache:clear
php artisan route:cache
php artisan view:clear
php artisan config:cache