What is the difference of using php artisan serve and by just using localhost/myproject/public?
Some of my code is not working when I'm just using the localhost/myproject/public, but when using php artisan serve all works just fine. Why is that?
main difference is who have the role to be the web server ? Means : who have the role to intercept HTTP request and provide it to PHP compiler.
With traditional web server (apache, nginx ...)
Web service will catch request, then ask php to do traitment with.
With PHP server php artisan serve php himself have role to manage this step. that means, if error happen on your process, this will shutdown your server. Apache will not be affected by this error, so rest of application will be still available.
Now about differente way to ask php to execute some code :
For Apache you can have php-mod, who are an extension of Apache or php-fpm (describe bellow)
For Nginx or other WebService, you have php-fpm or php-fastcgi, both are way (by TCP or Unix Socket) of communcation between your web service instance (processus) and php instance (processus).
php-cli who are the php instance spawn when you do php something on your terminal
For each approch you have differente php.ini and php extension to download / activate.
That means, for exemple, if you need to use Imagick library by command line tool (php-cli) and from your web server (php-mod on Apache) you have to download and activate this library on both setup.
Related
I've developed a web-application and I'm having trouble hosting it through a server, in order to give access to other users connected over the Local Network.
WINDOWS SERVER 2012
LARAVEL
PHP 7.2
NODE
MYSQL
When running the web application over localhost with the following command all files load correctly. (CSS, images etc..)
php artisan serve
However, when I've tried running the application over my ip address, no files load correctly and console logs the following errors for APIs net::ERR_CONNECTION_CLOSED
php artisan serve --host='my-ip' --port=8080
Command Prompt shows following error
Error Invalid request (Unsupported SSL request)
Testing was through Chrome Web Browser.
Any help would be greatly appreciated!
Have a good day :)
im new in laravel and i have done my first project, I have xampp,mysql and windows server 2012 (installed with composer and laravel 7). i'm running the application in server via command below
php artisan serve --host=[ip] --port=[port]
application is running fine within the network. However, it seems super slow. I'm not sure if this the correct way of deploying it into production. Do you have any recommendation/instructions where can i run/deploy apps within the resource that I have.
Speed of your laravel project depends on many parameters like hardware config (CPU,RAM,...) and also number of users and level of requests and processes. But consider that for an app in production it's better to not use php artisan serve command. It's only for development environment. I don't that how much you know about linux but I suggest you to change your stack and use linux as your production os with nginx as web server alongside php-fpm for running your app in production. But for now you should config xmapp's apache web server to run your application from project's public folder. Here is a link you can use: https://insidert.medium.com/setting-up-laravel-project-on-windows-2aa7e4f080da
good luck
This is my first time moving my Laravel RESTful api to the production server in CentOS environment using apache. To make it work I have to use
APP_URL=production_ip_address
MARKET_BASE_URI=127.0.0.1:8000
and php artisan serve or i
get cURL error 7
Is there any better way to do so if my APP_URL and MARKET_BASE_URI is same? This works on my local environment with the same URL and no issues, but Connection issues when i use the same in production environment.
use
MARKET_BASE_URI=127.0.0.1:9000
run
php artisan serve --port=9000
I was learning Laravel, I felt doubts regarding to the same.
Do we need APACHE server for Laravel? Because, without my LAMP server ON, I could do php artisan serve
Laravel server is working on HTTP, I wish to work it on HTTPS server.
Can someone help me in above questions?
Thanks in advance.
the php artisan serve is more for testing purpose, to start a development server, so you build you application as fast as you can to test it, but its not for running it to production.
and for your second question, with apache you can solve that, but if you still want to use it with the php artisan serve, you can use ngrok like this
cd <path-to-ngrok>
./ngrok http localhost:8000
https://ngrok.com/
I have a Laravel Project that I develop in PhpStorm. I use the build in PhpStorm web server for development and debugging. (localhost:8000) Now I need to be able to access that server from another device within the same network.
Google search and jetbrains.com have not been very helpful. I have tried this (https://intellij-support.jetbrains.com/hc/en-us/community/posts/207020155-phpstorm-and-http-server-localhost-only-) but it did not work.
Any help?
EDIT:
I found the problem. Since the web server is launched via artisan, it ignores my PhpStorm settings. I needed to change the launch parameter, like so:
php artisan serve --host=0.0.0.0 --port=8000