Laravel project did not start - php

Good day, I am completely new to Laravel, I have successfully installed laravel-9 on my window PC using XAMMP and composer, the installation was successful and everything worked fine, but when I shut down my computer system and latter wanted to start the project, I started my XAMPP and entered http://127.0.0.1:8000 in my browser's URL bar, but the project did not start. please what should I do.
I have tried to run
artisan serve
in my terminal, but not still working, please help

I have been able to resolve it, the mistake I have been making for couple of hours has been that after running php artisan serve command, it gives me the port 127.0.0.1:8000, I used CTRL+C to copy, but instead of pressing the command once, I pressed twice which the first time copied and the second time stopped the serve. Thanks to everyone who responded to me.

Related

xampp does not run php, browser asks what to do with file

I just installed xampp from www.apachefriends.org.
Per the instructions I ran
sudo ./xampp-linux-*-installer.run
Then xampp started and I saw the gui control panel. Everything great so far.
I verified it works by going to localhost in Firefox. I saw the welcome screen.
Then,I navigate to my test html. It is a contact which runs a php file when clicking submit.
Then firefox sends a message what to do with my php script, sendeail (save or select an application). sendeail is a no-brainer php script for email which I found on the internet years ago. It works when running from my server and has been for ages. Just now running locally with xampp started, Firefox doesn't know what to do with it.
What should Firefox do with this file?
Do I have to configure xampp somehow?
I couldn't test in Opera or Chrom(ium), the submit form doesn't appear for some reason on my local computer, but whose browsers work fine when accessing the page on the server.
I am running in Linux Ubuntu 16.4 LTS, Firefox 65.0.1 64-bit
--- edit ---
Specifically, the question is that the web browswer sees the .php file and tries to open it, what must I do for the web browser to be passed the code within the .php file, instead?
.apachefriends.org has no explanation of this. I found another page which explains, https://www.fayazmiraz.com/how-to-run-your-first-php-code/.
One has to put their php code into /etc/xampp/htdocs
That's so counter-intuitive!!! OMG why can't I keep my files in my development directory. Yeah, I can test this way, but I'll have to keep updating that directory whenever I have a program change! Thank you

How to solve the error "The localhost page isn’t working" in laravel

I am developing a web application in Laravel 5. I created the project in a local machine at my workplace and it runs just fine. But when i run the machine in another windows machine, it gives me an error The localhost page isn’t working with HTTP ERROR 500 as a server internal error.
I have also tried to look at the laravel.log file and found an exception Call to undefined function site_url() but don't know how to fix this.
Any idea on how to work around this is much appreciated.
This error is coming because you forgot to start laravel service.
If you wish to run your project on http://localhost:8000 Try with the following command :
php arisan serve
If you wish to choose specific port then try with the following command :
php artisan serve --port={port number}
Happy Coding :)
If you run local server by php artisan serve it will give url localhost:8000 by default and will run only in your machine to run in another machine of LAN you need to first find Local IP by ipconfig suppose you get this (192.168.2.10) then use this command.
`php artisan serve --host 192.168.2.10`
this will give url 192.168.2.10:8000 and can be access from any LAN connected machine.
In case none of this was working for you, there may be a more sinister explanation.
In our case, someone who shall go unnamed accidentally deleted the public/index.php file, and committed that to git! So taboo I didn't even think to look. This will stop ANYTHING in your site from running, including logging, but the server will go ahead, so there is nothing to go on, just a 500 error with no response or preview.
Again, seems ridiculous, but it was SO ridiculous who would even look for it?
please change your php version. you need to install php 7.2 version for laravel 5.6 version.

Using a .bat file to start xampp if it is not yet started

My problem is, I have a php system that I have developed for a small shop but the problem is that the users are not very much computer literate to start xampp everytime as my system runs on localhost.
I came up with this code for a batch file to start mozilla and get to the system folder in htdocs.
start firefox.exe http://localhost/systemname/
But my problem is if xampp is not started, the user meets a 404 error.
Can I use something like this (probably a php script)
if(batch xampp is not running){ start xamp & Mysql }
Thanks Guys I have found a solution
I created two vbs files to start http ans Mysql then created a .bat file to run both files and sleep for 30 seconds then start firefox to the htdocs\mysystem folder this is to give the servers enough time to start running.
Please ignore my quetion as my problem is ssolved if you encouter the same problem you may refer to this how-to

why should I keep running artisan serve command to keep the server working?

I'm learning laravel, and at the beginning I had run the command
php artisan serve
and keep my terminal window open so I can keep the server running, but later I wanted to just work with my app just like working on a normal php application so I created a virtual host directed to my laravel application "public" folder.
here is the problem:
I still have to run the "php artisan serve" and open my virtual server url
http://brk.localhost:8000
and then close the terminal, all that before I can normally open this link without defining the port number 8000.
and If I left my computer and get back to continue work, I found that I can't access it unless I do the whole process again.
and If I made a modification to any of the application views I get the same problem.
what am I missing?
Just add the and symbol '&' to the end of the command. This will keep it running in the background.
There are 3 main ways that you can access your Laravel app while you are developing it.
1) Using artisan serve
This method is probably the easiest method but it does mean that you have to remember to do this every time you start working on your project, which you have said that you do not want to do.
2) Using Laravel Homestead
This method requires a little more configuration but the documentation is very good. You won't have to remember to keep the terminal window open when you use it, but you'll still have to remember to keep the virtual machine running.
3) Set up LAMP / MAMP / WAMP or even LEMP
Setting up a local Apache or Nginx daemon on your own machine will require the most amount of configuration but it will mean that your web server automatically starts with your OS so whatever you put in your web directory will always be accessible through the web browser. You will not need to run and terminal commands or run a virtual machine.
Please note, however, that by using a local Apache/Nginx daemon you will be sacrificing a lot of flexibly and you will not have the luxury of deleting it all and starting again in a few minutes if you mess up the config.
Still, a lot of people still prefer to run their own Apache/Nginx daemon locally for development. I am one of them.
I encountered a similar situation where, if I were to save any modification to project files, I had to run "php artisan serve" and quit it before apache2 can serve the site.
I fixed it by modifying the file system permissions for my project.
I found this , which fixed the permission issue.
This solved the situation where I had to run php artisan serve, over and over again.
Primary cause of this is running package managers as sudo. Every file is created with bad permissions.

Failed to open Stream, no such file or directory

I recently started using the Laravel framework and i set up a little workspace for me to work in. I setup a Xubuntu client at home that runs a Apache server from which i program and host my Laravel instance from. Now recently I've run into a little bit of a problem. I was following a tutorial series and everything went fine, the next day however i run into this error http://puu.sh/nh5vQ/8ae11c52ab.png
Both from opening the /var/www/html/test/public directory in apache2 from my webbrowser or from running php artisan and actually hosting the laravel instance.
So the first thing that came to mind was permissions, but the permissions for the public folder are fine, It should be able to read or execute as any program. http://puu.sh/nh5Ho/06e061a056.png
Mostly other posts can reference to a bit of code where they specified the wrong filepath. What i find odd is that when i open my hosted instance of apache server in my webbrowser, where you can technically browse all the files in the hosted directory it is there in the list, but when i click it it pops up with that same error.
I checked if all the files that the server is trying to acces exist, and they do exist and i made no typo's.
I'm going to continue on looking and i shall post the solution as soon as i find one, though I'm hoping you guys have an idea since I've been looking for about 2 days to find a solution.
Thanks for your time
I Decided I'd have to start a new Laravel project to fix this without making a chaoticly configured project.

Categories