Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulBazith's avatar

How to run laravel project locally without using "php aritsan serve" command?

Guys i have done an web application in laravel "milkfarm" which maintains the accounts of milkfarm

Now i need to install the application to the client laptop.

What i did is

installed xampp to his laptop

imported the sql file in his laptop

after that copied the project folder to his laptop in htdocs folder

then open the project folder "milkfarm" in command prompt then, followed the belowsteps

composer install 

Run php artisan key:generate

Run php artisan migrate

i think now my db is ok and the project also ok.

Now i need to run the project without giving "php artisan command"

that is starting the xampp then in browser

if i give

 // laravel is folder name and milkfarm is project name

localhost/Laravel/milkfarm   

The first page is loaded then if i click the link in nav bar it shows error

page not found

I reffered in google and i got the answers

to rename the server.php to index.php and the copy the .htaccess file to root directory in the project.

I done that tooo

now if i give

localhost/Laravel/milkfarm   

the first page is loaded without the css files and also if i click the menu login the same error page not found

What should i do

Kindly suggest please.

Why i am asking this because, my client don't have too much knowledge. he maintained his accounts manually only..

so i created a application for his accounts work.. if the application is done in "vb" it is simply converted into .exe file and we can install in that system and we can use it.

i should get familiar in laravel so that i developed that application in laravel, and in future that application can be hosted so i created that application in laravel.

Presently it is going to be run locally in his system only.

to make work simple we are creating application.

but i f say to my client to on the xampp, go the folder, type php artisan serve. how can he remember this.

Is there any simple way please kindly suggest please..

0 likes
24 replies
Sergiu17's avatar

According to your title

cd /project/root
php -S localhost:8888 -t public
2 likes
munazzil's avatar

@AbdulBazith

Run like below in your browser.

                    localhost/Laravel/milkfarm/public  or  
                    localhost/Laravel/milkfarm/public/login
1 like
Benko's avatar

PHP allows you to run your own virtual server. Either do what @Sergiu17, or, for simplicity, you may just go to the public folder and run:

php -S localhost:3000

3000 is a port the server will run on, you can choose pretty much anything till 65,536 or so, for as long as that port is available.

See here for details:

http://php.net/manual/en/features.commandline.options.php

-S parameter is described as 'Run with built-in web server.'

1 like
AbdulBazith's avatar

@munazzil thank you for your response

no it not worked if i give


http://localhost/laravel/milkfarm/public/

it displays my first page when i click the nav bar login it show the below error

Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

1 like
AbdulBazith's avatar

@Benko thank you for your response

i tired as u said php -S localhost:3000 i command like this in my public folder in cmd prompt

it gave


PHP 7.2.4 Development Server started at Tue Oct 30 16:49:25 2018
Listening on http://localhost:3000
Document root is D:\XAMPP\htdocs\Laravel\milkfarm\public
Press Ctrl-C to quit.

then i tried the below in browser

http://localhost/laravel/milkfarm/

but showed error

Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403

if i give like this http://localhost/laravel/milkfarm/milkfarm

then the page opens and then if i click any of the nav bar it say

Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.


My laravel version is "5.6"


is there any other way..


1 like
munazzil's avatar

@AbdulBazith

I also used 5.6 but my folder is in the .htdocs i am not used any other main folder and i'm access through

    localhost/milkfarm/public
1 like
AbdulBazith's avatar

@munazzil

ya mine also i installed xampp in d:

so my project folder is milkfarm. it is in laravel folder in htdocs

D:\XAMPP\htdocs\Laravel\milkfarm

this is my project location

munazzil's avatar

@AbdulBazith

I also tried with using this Laravel folder, but unfortunately it is not working showing error can you please remove that folder and can you make it

        D:\XAMPP\htdocsl\milkfarm

and try

               localhost/milkfarm/public
munazzil's avatar

Did you check your client has internet because css you may used CDN.?

AbdulBazith's avatar

@munazzil .. no iam not using any cdn.. i have all those css files locally.

and even i tried by removing laravel folder

same problem http://localhost/milkfarm/public/

the page is opening and in my nav bar i have a login button if i click that

http://localhost/milkfarm/public/Auth/login it is redirecting to this address with error

Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

munazzil's avatar

Can you show your web.php? and your .env also?

towhid's avatar

dear @AbdulBazith brother -

if you want to server run with out php artisan then you run your command promt and simple - located your project folder . Example : C:\xampp\htdocs\your project folder name and then type this code

php -S localhost:8888 -t public

and then you move your - file index.php and .htaccess from public to root folder ( your project folder name ) then open your index file and change like my code

require __DIR__ . '/../vendor/autoload.php';
to 
require __DIR__ . '/vendor/autoload.php'; 

and 

$app = require_once __DIR__ . '/../bootstrap/app.php';
 to 
$app = require_once __DIR__ . '/bootstrap/app.php';
AbdulBazith's avatar

@towhid tried and not working,, same problem,, css files are not called. and if i move to next page. page not found..

and @munazzil

this is my web.php


<?php

/*

 Route::get('vendor_details','pagescontroller@getvendor_details');

//Authentication routes

 Route::get('Auth/login','Auth\LoginController@showLoginForm')->name('login');
 Route::post('Auth/login','Auth\LoginController@Login');
Route::get('Auth/logout','Auth\LoginController@Logout')->name('logout');


//Register routes

Route::get('Auth/register','Auth\RegisterController@showRegistrationForm') ->name('register');
Route::post('Auth/register','Auth\RegisterController@Register');






Route::get('/', 'pagescontroller@getIndex');


Route::get('/welcome', 'pagescontroller@gethome');

Route::get('/welcome1', 'pagescontroller@getIndex');









Route::resource('Vendor_details','MilkController');
Route::resource('Location_details','location_detailsController');
Route::resource('Customer_details','Customer_detailsController');
Route::resource('Employee_type','Employee_typeController');
Route::resource('Purchase_details','Purchase_detailsController');
Route::resource('Sales_details','Sales_detailsController');

Route::resource('Self_stock','Self_stockController');

Route::get('fetch_area','MilkController@fetch_area');
Route::get('fetch_booth','MilkController@fetch_booth');
Route::get('fetch','Customer_detailsController@fetch');
Route::get('fetch1','Customer_detailsController@fetch1');
Route::get('autosugest_vname','MilkController@autosugest_vname');
Route::get('autosugest_cname','Customer_detailsController@autosugest_cname');
Route::get('autosugest_loc','location_detailsController@autosugest_loc');
Route::get('autosugest_area','location_detailsController@autosugest_area');
Route::get('autosugest_booth','location_detailsController@autosugest_booth');
Route::get('autosugest_ename','Employee_typeController@autosugest_ename');
Route::get('fetch_ven_area','Purchase_detailsController@fetch_ven_area');
Route::get('fetch_ven_area1','PayController@fetch_ven_area1');
Route::get('fetch_cus_det','Sales_detailsController@fetch_cus_det');
Route::get('fetch_cus_det1','ReceiveController@fetch_cus_det1');



Route::resource('Pay','PayController');
Route::resource('Receive','ReceiveController');

Route::get('open', 'OverallController@open')->name('Overall.open');


Route::resource('Overall','OverallController');

Route::resource('Excess_milk','Excess_milkController');


Route::get('create_for_personal', 'PayController@create_for_personal')->name('create_for_personal');
Route::post('personal_store', 'PayController@personal_store')->name('personal_store');

Route::get('open_personal_account', 'OverallController@open_personal_account')->name('Overall.open_personal_account');







/* Route::get('open', 'OverallController@open'); */


/*

Auth::routes();

Route::get('/', 'HomeController@index')->name('home');

Auth::routes();

Route::get('/', 'HomeController@index')->name('home');
 */






 //Search Process Routes

 Route::get('/search_name','Sales_detailsController@search_name')->name('search_name');
 Route::get('search_name1','Sales_detailsController@search_name1');
 Route::get('search_vendor_details','MilkController@search_vendor_details');
 Route::get('search_location_details','location_detailsController@search_location_details');
 Route::get('search_employee_details','Employee_typeController@search_employee_details');
 Route::get('search_customer_details','Customer_detailsController@search_customer_details');
 Route::get('search_purchase_details','Purchase_detailsController@search_purchase_details');
 Route::get('search_self_stock_details','Self_stockController@search_self_stock_details');
 Route::get('search_overall_stock_details','OverallController@search_overall_stock_details');
 Route::get('search_pay_purchase_details','PayController@search_pay_purchase_details');
 Route::get('search_receive_sales_details','ReceiveController@search_receive_sales_details');
 Route::get('search_excess_milk_details','Excess_milkController@search_excess_milk_details');
 Route::get('search_paid_details','OverallController@search_paid_details');
 Route::get('search_received_details','OverallController@search_received_details');
 Route::get('search_personal_accounts','OverallController@search_personal_accounts');



 //PDF

 Route::get('downloadpdf_sales', 'Sales_detailsController@downloadpdf_sales')->name('downloadpdf_sales');

 Route::get('download_excess_milk', 'Excess_milkController@download_excess_milk')->name('download_excess_milk');

 Route::get('downloadpdf_location_detail', 'location_detailsController@downloadpdf_location_detail')->name('downloadpdf_location_detail');

 Route::get('downloadpdf_vendor_details', 'MilkController@downloadpdf_vendor_details')->name('downloadpdf_vendor_details');

 Route::get('downloadpdf_employee_type', 'Employee_typeController@downloadpdf_employee_type')->name('downloadpdf_employee_type');


 Route::get('downloadpdf_customer_details', 'Customer_detailsController@downloadpdf_customer_details')->name('downloadpdf_customer_details');

 Route::get('downloadpdf_self_stock', 'Self_stockController@downloadpdf_self_stock')->name('downloadpdf_self_stock');


 Route::get('downloadpdf_overall_stock', 'OverallController@downloadpdf_overall_stock')->name('downloadpdf_overall_stock');


 Route::get('downloadpdf_paid_details', 'OverallController@downloadpdf_paid_details')->name('downloadpdf_paid_details');

 Route::get('downloadpdf_received_details', 'OverallController@downloadpdf_received_details')->name('downloadpdf_received_details');



 Route::get('downloadpdf_personal_accounts', 'OverallController@downloadpdf_personal_accounts')->name('downloadpdf_personal_accounts');


 Route::get('downloadpdf_pay_purchase', 'PayController@downloadpdf_pay_purchase')->name('downloadpdf_pay_purchase');


 Route::get('downloadpdf_receive_sales', 'ReceiveController@downloadpdf_receive_sales')->name('downloadpdf_receive_sales');



 Route::get('downloadpdf_purchase', 'Purchase_detailsController@downloadpdf_purchase')->name('downloadpdf_purchase');







 //Excel


 Route::get('downloadexcel_sales', 'Sales_detailsController@downloadexcel_sales')->name('downloadexcel_sales');

 Route::get('downloadExcel_excess_milk', 'Excess_milkController@downloadExcel_excess_milk')->name('downloadExcel_excess_milk');

 Route::get('downloadExcel_location_details', 'location_detailsController@downloadExcel_location_details')->name('downloadExcel_location_details');

 Route::get('downloadExcel_vendor_details', 'MilkController@downloadExcel_vendor_details')->name('downloadExcel_vendor_details');

 Route::get('excel_employeetype', 'Employee_typeController@excel_employeetype')->name('excel_employeetype');


 Route::get('downloadexcel_customer_details', 'Customer_detailsController@downloadexcel_customer_details')->name('downloadexcel_customer_details');

 Route::get('downloadexcel_self_stock', 'Self_stockController@downloadexcel_self_stock')->name('downloadexcel_self_stock');

 Route::get('downloadexcel_overall_stock', 'OverallController@downloadexcel_overall_stock')->name('downloadexcel_overall_stock');

 Route::get('downloadexcel_paid_details', 'OverallController@downloadexcel_paid_details')->name('downloadexcel_paid_details');

 Route::get('downloadexcel_received_details', 'OverallController@downloadexcel_received_details')->name('downloadexcel_received_details');

 Route::get('downloadexcel_personal_accounts', 'OverallController@downloadexcel_personal_accounts')->name('downloadexcel_personal_accounts');

 Route::get('downloadexcel_pay_purchase', 'PayController@downloadexcel_pay_purchase')->name('downloadexcel_pay_purchase');

 Route::get('downloadexcel_receive_sales', 'ReceiveController@downloadexcel_receive_sales')->name('downloadexcel_receive_sales');


 Route::get('downloadexcel_purchase', 'Purchase_detailsController@downloadexcel_purchase')->name('downloadexcel_purchase');


//DayBook


Route::get('daybook','ExportController@daybook')->name('daybook');

// Route::get('daybook', 'Excess_milkController@daybook')->name('daybook');


and this is my .env file


APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:tpC//+AYXFcurEJ8XcsJZ5Q+p05brXabaaTR2OZ6q90=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=MilkFarm
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"



shez1983's avatar

have you tried valet or homestead? not sure why built in php isnt working for you though.. try looking at the SOURCE of the page when css dont load and see where the path is linked to..

munazzil's avatar

@AbdulBazith

You haven't assign the mikfarm route, Use as like below and try.and i would like to know that which kind of laravel version are you using?

Route::resource('/milkfarm','MilkfarmController');
FabioPacifici's avatar

@AbdulBazith If you client laptop is running Windows 10 you might want to enable WSL (Windows subsystem Linux) instead of using xamp then once everything is set up properly you can load your website on that laptop by simply visiting site.dev.

ignore the points where I am installing wp-cli on my environment.

At the end of the article you can find reference to the main post from valeryan.

https://fabiopacifici.com/my-development-environment-for-laravel-wordpress/

I hope it helps.

AbdulBazith's avatar

@FabioPacifici thanks.. let me try .

@munazzil may i know for what reason i need to make controller

Route::resource('/milkfarm','MilkfarmController');

and my version is 5.6

munazzil's avatar

It is note controller it route because without assigning a route youte you won't be able to visit that page.As you said previously you want to visit Laravel/milkFarm but it not assign in your route.

neilcarpenter's avatar

Just bare in mind that if your milkmans machine dies, his entire system will be gone... I think you'd be much better off setting something up online to host your project!

Please or to participate in this conversation.