how to access the laravel project after installation? - php

I have installed the laravel 5 on my local machine.And made the changes in the database.php file in config folder.I have set my credential.Now I am accessing the folder http://localhost/laravel/public/ but it displays html page with this content. Whoops, looks like something went wrong.What configuration should I set apart from this database.php so that it works fine.

This will likely happen to you everytime you create a new Laravel project. The problem is that your webservice (apache/nginx) doesn't have read/write permissions for the storage folder. From the root of your installation perform a chmod 777 -R ./storage and that should get you to the welcome to Laravel screen you should expect for an installation, and from that point on you should now get the error reporting if you have debug mode set as true. If you are still having trouble, you may need to provide access to the ./public folder as well.

You can run laravel application when you have successfully installed in your machine, Add '/public' in url after root folder. Means you have installed app on www.firstlaravel.com and your root folder is 'first'.
So you can run app using like => www.firstlaravel.com/public

Related

Run laravel project in localhost

I have installed laravel by composer create-project laravel/laravel –-prefer-dist
after this run php artisan serve command to laravel project directory and get this result.
Laravel development server started: http://127.0.0.1:8000
But when i go to http://127.0.0.1:8000 in browser laravel project not running and give error
This site can’t be reached
127.0.0.1 refused to connect.
but http://localhost/laravel/public/ it is working. Can anyone tell me that what is proper way to run this laravel project.
Try to run in different port
php artisan serve --port=9000
and then try http://127.0.0.1:9000 will work.
As might be on port 8000 something already running on your system will not make it work.
And you can also run your laravel project without artisan serve command
If anyone wants to make the application public, the more easy and fastest way is:
Rename the "server.php" file in root directory, in "index.php"
Move your .htaccess from public folder to root directory
Make your directory accessible to Apache2 (set all file permissions
to 777).
At starting level, you can use url like this http://127.0.0.1:8000 with port-number. but in further level you must working with simple url like http://localhost/laravel/public/.
One more thing - you should remove "public" keyword from url, so you access direct your root-project. Review this link - Laravel 5 - Remove public from URL
I had that problem too! And couldn't solve it. So I installed openserver from https://ospanel.io/ and put my site on the folder domains (Windows 10), then I just start Open Server and click "My Sites" and choose my site - it opened in my browser which set by default on Open Server program and click the folder on my browser cooled "public" and there you go -> your site is working.
I now that isn't solve the problem with cmd and start thought cmd and server like http://127.0.0.1:8000, but you can take access to your local site through http://'your site'/public/'your pages'
Good luck!
Changing the port will help.
php artisan serve --port=9000
worked for me
Try this
php -S 127.0.0.2:8000 -t public/
It will start your local development to http://127.0.0.2:8000 which will work great.
OR
You can try instead
php -S 127.0.0.1:8000 -t public/ It will work in any browser as compare to command php artisan serve which open url http://127.0.0.1:8000.
Successfully landed to Laravel page by the following steps.
Note: This is after the successful installation and configuration.
Was in /var/www/html/
Created the project using the following command after Laravel installation successfully
$laravel new firstapp
here firstapp is my project
cd to firstapp (folder created with project creation with $laravel new firstapp)
serve using the following command
$ php artisan serve
The project ready to serve with the following statement as below
Laravel development server started: http://127.0.0.1:8000
You can access the laravel page using the following URL
http:///firstapp/public/
Sometimes this occur when you have installed an anti virus software. Anti-virus deleting your "server.php" file. For that you can create an exception in anti-virus for "server.php" file or creating a "server.php". You can find relevant code for the file searching. Basically server refuse to connect occurs when the "server.php" deleted or removed from the file path.

Deploy laravel on blueMix

I have a VPS of blueMix, My cPanel's file Manager have folder public_html where i dropped a file index.php having some php echo 'tesing'; which wasn't loading up, After some research i found out that my root Directory is /var/www/html. But any how i dropped my project there like /var/www/html/project and then came up checked like example.com and that redirected me to the hosting default page, example.com/project show project root files and folders, example.com/project/public returned internal server error 500. Permissions seems ok.
What am i missing, Is there a slandered way ? Please help out.
Q1 : How can i set my root directory public_html.
Q2 : How to deploy laravel in /var/www/html or public_html.
modify this Lines from Public->index.php to the public_html .
require __DIR__.'/../public_html/bootstrap/autoload.php';
$app = require_once __DIR__.'/../public_html/bootstrap/app.php';
and check..
After hours of research, I easiest way is to have a server with out a lamp stack, Install a custom lamp stack, One by one component, Look for the apache configuration, Set the permissions, And you are good to go.

Laravel error page not showing when using virtual host

I install new laravel package through composer and everything is going fine (including the error page) when I use php artisan serve and access my project in http://localhost:8000. But when I use virtual hosts (for example: example.dev), the error page is not showing, just a blank page. I'm not sure if it has something to do with my virtual host configuration because if the code has no error, the page just load normally. And I have changed the permission of storage and bootstrap/cache folder to 777.
Is there any other configuration that have to do?
Which PHP version do you use on your server? Check the logs and see if you find something there.
Try giving the entire Laravel folder 755 permissions and then change the bootstrap/cache and storage folders.
Also try editing your .htaccess file, add something like:
RewriteEngine On RewriteBase /

PHP site developed using Laravel 5 is not getting rendered after Hosting

I developed a php site using Laravel 5 and tried hosting it in a LAN Server running UBUNTU 14. But when I navigated the page I'm just getting a Blank Page. No errors at all. I inserted a simple echo statement in index.php and I got the relevant echo.
There can be many reason. If you are using Laravel 5.0, you will need at least PHP 5.4. For Laravel 5.1, you will need 5.5.9. But if you have installed PHP using sudo apt-get install php5 you are most likely to have PHP 5.5.9 or later. Because that is the default version for Ubuntu 14.04 LTS. try running php -v from terminal to check the version.
There can also be a Permission issue for storage folder.
From project root folder run following command,
sudo chmod 755 -R storage
Basically, laravel needs write access to storage folder to write a log in storage/log directory or to write a compiled view files in storage/framework/views etc. You can try 755 first. If that does not work try 777.
Laravel shows nothing on certain fatal errors. For instance a class that can't be found or the storage directory and subdirectories that should be writable for the web user (www-data). This should show up in the error log of the webserver.
I believe you have permissions issue chmod 755 storage folder located in the root of your web project. If that doesn't works do it 777.
The reason why echo in the index.php is working is because this is the first file called when you execute the laravel app and the index file calls services provider and other required files, in this process the app creates a cache file under storage/framework/views/ folder but these files does not have write permissions, but as you echo something you get that output because it has been called even before anything was called.

laravel 4 does not work on Windows XAMPP

On Windows 7 cmd I have run composer create-project laravel/laravel blog --prefer-dist from `C:\xampp\htdocs\lara. Everything is downloaded and installed fine.
However, when I try to access http://localhost/lara/blog it shows the directory listing of apache. I followed the instruction in the documentation during the installation.
I noticed the following notes:
C:\xampp\htdocs\lara\blog does not has any index.php or .htaccess
C:\xampp\htdocs\lara\blog\app also, does not has any index.php or .htaccess
Only accessing http://localhost/lara/blog/public opens a page with the laravel logo and the words "You have arrived"
I could not able to know what's the problem?
Laravel's folder structure uses the public folder as the WWW root, effectively placing all your application's files outside of the web root to help keep them secure. What you are experiencing is normal.
You'll have to either access your application from the http://localhost/lara/blog/public URL, or set up a virtual host URL (e.g. http://testblog.dev) that is pointed to the public folder. I do not develop on Windows/XAMPP so I cannot specifically tell you how to do that part.
If you're running php > 5.4 you can serve the app using the builtin server from command prompt as well (for development purposes):
php artisan serve
I have an answer on How to install Laravel via Laravel Installer on Windows?
or
http://goo.gl/uftcSo
for more details
Hope that helps.

Categories