How can i enable artisan commands in cpanel? - laravel-5

as you probably knew when we connect to C Panel and host by remote in php storm ...
we are not able to use from php artisan commands
how can i enable it? in really host?

Related

how run laravel php artisan websocket:init command on online server?

i run websocket on localhost in laravel with this command:
php artisan websocket:init
and It works properly.
but i use cpanel in online server. and i dont access to terminal. how run websocket on online server?
You dont, you need to have ssh access to the server to run the command. You can try schedule to run the command but I'm almost 99% sure that won't work. I talked with my hosting company if I could run a simple cache clear and they said I had to pay for ssh access.

How to run Laravel artisan on a live server without shell_exec?

My new project is based on Laravel framework, and developers need to run php artisan commands to do their requirements. On the other hand, server configuration disabled shell_exec for security purposes.
What should I do for this case? Is there any secure way for developers considering server security issues?
There are three ways to run php artisan command.Below i have mention all of them :
1) Use Terminal which is on server.Through that you can execute the php artisan command.
2) Use "putty" software to access the server.In that you can connect putty with server.For connection to the server you require "SSH credential" which you can create on server.
3) Using route you can execute artisan command.But for that every time you need to add/modify route and execute that in the browser so that artisan command will execute.Below i have given an example of it.You just have to put it in the routes file:
Route::get('command', function () {
/* php artisan migrate */
\Artisan::call('migrate');
dd("Done");
});
The above route you need to call through browser.This route will execute command of "php artisan migrate".

Laravel-Php artisan serve url (127.0.0.1:8000) vs localhost/laravelproject/public

I want to access my laravel project.I run php artisan serve and access the 127.0.0.1:8000 in browser.
But i learned that I can also check my project using the localhost/laravelproject/public url whithout running php artisan serve.
Question: What is the point of using php artisan serve?
No point in two different methods like you mentioned run laravel by "php artisan serve" and by "project url" followed by localhost. But advantage of "php artisan serve" is you can run you laravel project without putting in htdocs/www directory i.e servers root directory. You can put laravel project anywhere where you want and run through the artisan command.
I found some information you may find interesting:
https://www.quora.com/How-can-I-use-php-artisan-serve
But in simple words, php artisan serve is an easy way to create a php server and that is what laravel needs to run.
You could do the same with "php -S 8080 (which would start a php web server (single threaded) in the current directory on port 8080)"
Also if you have already a php server running with apache or nginx it would not be necessary any of the commands.
Hope you find this helpful.
The `Serve command is just a shortcut for the PHP Builtin Webserver, something PHP has out of the box, so the point of using it is to start testing your application as fast as you could, you just need to install PHP, Composer and your application is up (if you don't need anything else, of course). But if you already have Nginx installed, there is no point at all, just use it.
It's not wise to use the Builtin Webserver in production.

Artisan Error: Failed to listen on localhost:8000 (reason: An attempt was made to access a socket in a way forbidden by its access permissions. )

I'm having problem starting my laravel installation. Whenever I type in the terminal php artisan serve, it throws me an error like below:
c:\wamp\www\blog>php artisan serve Laravel development server started
on http://localhost:8000/
[Sat Nov 05 21:18:39 2016] Failed to listen
on localhost:8000 (reason: An attempt was made to access a socket in a
way forbidden by its access permissions.)
1) First firewall restore to default
2) change artisan serve port using this command php artisan serve --port=3232
Trust me its works :)
I faced the same problem today. I just restarted the my machine, after that tried with the same port and it works!
Change artisan serve port using this command
php artisan serve --port=####
instead #### you can enter your own port number.
This will work sure.!
You need command prompt to run as administrator, that solves the problem most of the time.
First make sure your installed Laravel properly in your local machine.
When you execute php artisan serve , you better to run it with administrative priviledges.
In linux, I use
sudo php artisan localhost:8888 -t public
Make sure other requirements such as php version are upto date.
PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
For more information refer this document.

Laravel php artisan serve logs stored and start artisan serve automatically

id like to know :
Where Laravel php artisan serve command logs stored ?
How to automatically start php artisan serve when sever (Apache) starts ?
Laravel logs are stored at storage/logs
You don't need artisan serve, if you have Apache handling your HTTP traffic.
To the first question
Where Laravel php artisan serve command logs stored ?
Laravel server logs are stored in storage/logs folder ,which contains files for the server logs
To the second question
How to automatically start php artisan serve when sever (Apache) starts ?
If you need to automatically ,A very simple way to do this would be to use use laravel scheduling Artisan Commands using cron
Ensure cron is installed yum install vixie-cron (assuming you use centos). Start it with service crond start
Add laravel Schedule object vi /etc/crontab and add * * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1 ,to the cron schedule file .
Go to app/Console/Kernel.php file and add $schedule->command('foo')->withoutOverlapping(); where foo is the artisan command you would like to run in this case serve , so it should be $schedule->command('serve')->withoutOverlapping();
Restart cron deamon with service crond restart.
See this related question https://stackoverflow.com/a/34096590/1226748
I would definitely recommend NOT using artisan's server in production like EVER, it's for testing only. -- You would be WAY better off to use nginx as a reverse proxy and you can set whatever port you want that way, and have your angular app still connect to it.

Resources