How can I run CLI commands in the cpanel

Website URL

https://awelle.42web.io

Error Message

I have a laravel project first I dont know why I cant unzip the file after uploading it , I unziped it locally than started uploading it after it finishes I dont know where can I find the CLI so I can run composer install, npm install , and the most important running the website using php artisan serve ?

Other Information

(other information and details relevant to your question)

1 Like

You cannot use CLI on free hosting. You need to run the composer commands locally and then upload the content of your website into the /htdocs folder.

10 Likes

what about the data base and the migrations , and in order to run the app I used to run php artisan serve ?

You do it locally, then export the local laravel database, then import it to the new hosting database.

No need, the server used here is Apache for processing php program so there should be no problems with running laravel.

10 Likes

For development on your own computer, you do, yes. But you’re not running in development on your own computer when deploying your site.

Web hosting comes with it’s own PHP runtime environment, you do not need to (and cannot) start your own server process to serve your website.

If you ever get in a situation where you do, please understand that artisan serve is a development server, and should under no circumstances be run on a live server.

The main issue is that artisan serve is a single threaded process, so only one request can be handled at any single time, giving you unusable throughput on a real site. Performance and security is also not a design goal of the dev server, so serving static files (like CSS, JS, images) is also rather slow.

7 Likes

what about the unzipping files problem ? is is a commune thing in free hosting ? cause Im trying to upload the files using file zilla and the connection to the hosting cuts each 10 to 20 seconds I dont know why (my connection to the internet is stable) beside it takes hours just for 100 mo folder

Do not upload a whole archive file, upload each file and folder separately using FileZilla.

8 Likes

Sorry after uploading the files Im getting this request message

Run npm run dev in your terminal and refresh the page.

how can I deal with this from cpanel .

Run it locally and then upload your files again…
If it is something which requires node.js to run then you cannot do it here.

9 Likes

npm run dev with php artisan serve must keep running in the development in order to make the app running , Im not using any js framework just blade with laravel , I dont know how this will effect the code when I upload it

Then you probably won’t need it. Disable developer mode and then upload the files.

6 Likes

you can actually execute artisan commands from laravel. but on free hosting, forget it, that functionality is blocked. ( for good reason ).

I know this for a fact as I host Laravel sites on premium hosting.

I have used that feature before and it is not related to what I tried to imply.

2 Likes

but it works! :slight_smile:

It works on local environments and other hosting platforms (such as premium hosting), but it doesn’t work on free hosting, which is what the original poster is asking about.

6 Likes

I humbly apologize and will refrain from interjecting in this conversation.

1 Like

But you’re not running development. Both of those are designed to be able to make changes to the code and immediately see the changes. Which is useful in development, but comes with some drawbacks that are disastrous in production.

In production, the production servers provide a PHP environment to replace artisan serve, and for the NPM stuff you just run npm build once to compile the code, and just serve those as static files.

9 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.