-2

EDITED So i bought this Laundry POS Application from codeanyon and want to run it on stand alone computer ( not server) or hosting online This is the app purchased.

Also this is their documenation which seems to be obselete and old Here.

while discussing with them, they said i can use XAMPP, however with all the support shared by stackoverflow fellow professionals, it was adviced not to. thus ill do as adviced after having help to deploy.

As i understood, the app uses artisan to install requiremnts. i have done that with no sucess.

** Can anyone help me properly run the application as when i reach php artisan serve and open http://127.0.0.1:8000/install and provide the required settings and click next, nothing happens although in backgroup i see db create in myphp

8
  • The php artisan serve command opens a direct port to your Laravel project so that it can be easily accessed. I'm not entirely sure what you're trying to automate. For production code, you should point your domain to the /public directory. This way, example.com , which points to the public folder, will route all incoming requests to /public/index.php due to the .htaccess file in that folder. Commented Mar 15 at 17:43
  • Whats the point of running Laravel with the command 'php artisan serve'? Commented Mar 15 at 17:44
  • Thank you fo rthe quick reply. to be honest i am a compelte newbie and stubborn person that wants to do the solution myself. The app is a POS app for a restaurnt i own ( actually mini cafe) and i liked the challange to do it myself without a developer as i come from an IT background, but it appaers i defenetly lack development tech skills. can you guide please Commented Mar 15 at 17:46
  • XAMPP is outdated software. For development, you don't need anything extra, just PHP and an SQL server. With PHP, you can then open a port to any folder: php -S $host:$port -t public/ Commented Mar 15 at 17:47
  • 1
    I understand eveyones professionalism , especially mentinoning prod enviroment , which is good practive to have an admin startup the server , service, app server etc while debugging. Ill ask the question directly as adviced by rozsazoltan. But i am a small one person business, and would like the POS app to startup when windows starts , as simple as that. in return i would just pop up the broweer and login Commented Mar 15 at 18:03

2 Answers 2

1

I see that your project is located in the htdocs folder by default. In this case, without any modifications, you can access the public folder on port 80 using:

http://localhost/AppName/public/index.php

If the goal is to make your application secure locally and prevent direct access to files belonging to other projects (e.g., http://localhost/AppName/.env), then it is necessary to change the htdocs folder so that it points to your project's public folder. This is a huge security vulnerability, as the database password, for example, is stored in the .env file.

This way, you can access the public folder via http://localhost, and there will be no possibility to load content outside of the public folder. (Yes, in this case http://localhost/../.env will invalid request.)

Note: In my answer, I am not using the exact paths you provided, as I am trying to generalize the instructions. However, C:\path\to\laravelproject refers to your D:\xampp\htdocs\AppName directory.

Requirements

To host a website from your own machine on an internal network, you need a web server. XAMPP can be a great option for this, especially if you configure it to start automatically when Windows boots up.

  • Set your xampp.exe to start automatically on Windows startup.
  • In XAMPP, configure it to automatically start the web server and MySQL when the app launches (so you don't have to start them manually).

After that, you just need to manipulate the default root directory of the localhost:80 web address started by XAMPP - which is set to .\xampp\htdocs by default -; so that it points to the Laravel's public folder.

Set public directory with XAMPP

Solution #1: Change XAMPP default htdocs folder path (recommended)

Find and open the C:\path\to\xampp\apache\conf\httpd.conf file.

Look for a line where the DocumentRoot is set to C:\path\to\xampp\htdocs. Change it to:

DocumentRoot C:\path\to\laravelproject\public

If you want to continue using PHPMyAdmin, you will need an additional alias as well.

Find and open the C:\path\to\xampp\apache\conf\extra\httpd-xampp.conf file.

Look or create a new line where the Alias /phpmyadmin is set to C:\path\to\xampp\htdocs\phpMyAdmin. If not exists create this new line:

Alias /phpmyadmin "C:\path\to\xampp\htdocs\phpMyAdmin"

After that should restart XAMPP webserver.

Solution #2: Copy project's public folder to htdocs

By default, it will host the C:\path\to\xampp\htdocs folder. You should place the contents of your Laravel project's public folder inside the C:\path\to\xampp\htdocs folder.

If you choose to copy, you will need to make edits in the copied index.php file. You will find some relative paths that look for files in a parent directory. These need to be rewritten to point to your Laravel project.

Solution #3: Create a symlink from htdocs to project's public

On Windows, creating a symlink could also work, like C:\path\to\xampp\htdocs --> C:\path\to\laravelproject\public).

# By default htdocs existed, remove it by rename
ren "C:\path\to\xampp\htdocs" "C:\path\to\xampp\htdocs.bak"

# Run as administrator from cmd
mklink /D "C:\path\to\xampp\htdocs" "C:\path\to\laravelproject\public"

Note: I would not apply the descriptions of Solution #2 and #3 directly to the htdocs folder, but rather to the .\htdocs\myproject folder. In this case, however, the URL for your web application would not be http://localhost, but rather http://localhost/myproject.

Call project from browser

After this, you can load your Laravel project in the browser via the http://localhost port. (If there is no port specified, it refers to port 80, meaning by default, XAMPP is accessible via localhost:80.)

In your Laravel project's .env file, change the default paths from http://localhost:8000 to http://localhost. If you're not using this machine directly, I recommend using your computer's internal network IP address instead of localhost: http://192.168.0.100.

Note: If the machine from which you want to access the locally hosted website is not on the same network as the "server" machine, you can set up a virtual LAN network, for example, using RadminVPN or similar services. But in this case, you would need to set your VPN address in the .env file.

Installation as production

If you do not intend to develop or modify this application, it is advisable to set it up as a "production" version.

Sign up to request clarification or add additional context in comments.

10 Comments

It seems that during my installation and reading online topics, i used option 2 to Copy project's public folder to htdocs. In the context of the above, i searched for the index.php which i found under D:\xampp\htdocs\App\public but didnt understand what should be done much. below is a copy of the index
<?php use Illuminate\Contracts\Http\Kernel; use Illuminate\Http\Request; define('LARAVEL_START', microtime(true)); if (file_exists($maintenance = DIR.'/../storage/framework/maintenance.php')) { require $maintenance; } require DIR.'/../vendor/autoload.php'; $app = require_once DIR.'/../bootstrap/app.php'; $kernel = $app->make(Kernel::class); $response = $kernel->handle( $request = Request::capture() )->send(); $kernel->terminate($request, $response);
Well, for security reasons, in this case, I wouldn't store the Laravel project in the htdocs (just a public files) folder. For example, if you move it to the D:\AppName folder (from D:\xampp\htdocs\AppName), then in the D:\xampp\htdocs\index.php file, you need to modify DIR.'/../ so that it correctly points to the Laravel project: DIR.'/../../AppName/. (This means that 'current folder . go back one folder / go back one folder / go to the folder named 'appname'.)
Of course, you can place your AppName folder anywhere, but I wouldn't put it in htdocs. And wherever you place it, you should be able to reference it relatively from the index.php.
i did as adviced and placed it in the D:\AppName. can you share exactly what i should put in the index.php? if (file_exists($maintenance = DIR.'/../storage/framework/maintenance.php')) { require $maintenance; } require DIR.'/../vendor/autoload.php'; $app = require_once DIR.'/../bootstrap/app.php';
|
0

You can just change xamp to Laravel herd. When you use Laravel Herd, you don't need to run any command, just keep the project in the Herd folder and in your browser hit project__name.test this will work for every project.

3 Comments

The best solution instead of XAMPP is to install native PHP and MySQL, but the asker is not very familiar with these. The goal is to automatically host their own application locally on startup - almost like a production environment. How does Herd solve this? The asker does not want to do any development
Ur right Rozsazoltan, in fact, its not that i dont want to, its becuase i dont know how to. i think ill re-write my question in more details so that it can be clear for you. i already apprciate the effort and professional help and advice you provided. its amazing. you prefer i re-write the question again here or ask a new question?
Ill edit the initial question, include files I have and their installation docs. But will proceed how you advice as it seems they use obselete method

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.