Laravel showing index.php - php

Server Details:
windows server 2012 R2
Apache server 2.4
As IIS server works 8080 and Apache works on 8181 port
PHP 7.4
Mysql Database
We need to deploy the Laravel project on 8181 port.
We have run the composer successfully. After that save the Laravel project on htdocs of Apache24 folder. In htdocs we created Laravel folder into that we keep all the Laravel project file. so the path is c:/Apache24/htdocs/Laravel/public/index.php
In url it also shows the path like http://ip address:8181/Laravel/public/index.php. It shows the landing page of website. After that when click on register page it shows the register controller name after index.php like below
http://ip address:8181/Laravel/Laravel/public/index.php/register
This shows the extension of file as well as public folder, which is not standard Laravel pratice

You have to use artisan command in terminal or cmd for running laravel project.
php artisan serve
when use this artisan command, laravel runs on port 8000 as default but if you want run project on custom port, you can use port flag in artisan commad
php artisan serve --port=8181

You have to change some configuration
In your public directory all files cut and copy at your Laravel folder. And you have to change some configuration in your index.php file
require __DIR__.'/vendor/autoload.php';
and
$app = require_once __DIR__.'/bootstrap/app.php';
And just url like this
http://ip address/Laravel/

Related

Laravel 7.28 not work without php artisan serve command in localhost

Laravel 7.28 not work without php artisan serve command in localhost
I install new Laravel in localhost (/var/www/html/NewLaravel)
When I run http://localhost/NewLaravel/public/ not workling
but when I run with php artisan serve its working on http://127.0.0.1:8000/
Apache2 is working proper and allow access of override for .htaccess
is that new Laravel will only work with php artisan serve ?? or something is missing from my side ?
Step-1:
run apache and sql from xampp server
step-2:
in browser type localhost/NewLaravel and press enter
Step-3:
in list please select public folder it will run

laravel php artisan serve not serving the current directory

Whenever I try to run
php artisan serve
on my newly created laravel project directory, it always serve the other project from another directory.
I am using homestead virtual box's latest version with vagrant.
If I try to delete/rename the project that is being served, then run php artisan serve on my new project, the browser will show
No input file specified.

How to configure Laravel application on localhost?

I'm new to Laravel framework. I have installed and developed a small application. I've got source code from Github for an application which I want to integrate and run on my localhost. Please guide me any link or material where I get proper instructions to start working on this website. Give me details about which file to be edited so that atleast I can access on my localhost.
Github link : https://github.com/fakharkhan/laravel-school-erp
If you don't want to use homestead (which is somewhat complex for beginners to setup) follow this:
steps to setup laravel app from github repo
first of all you need to install git and composer.
open command prompt (terminal) in your document root folder.
clone the repository by executing git clone https://github.com/fakharkhan/laravel-school-erp.git
change directory in terminal to newly cloned project by using cd laravel-school-erp in your case.
run composer install to install project dependencies.
rename .env.example to .env file.
open .env file and enter the database connection information.
run laravel migrations (import database) by executing php artisan migrate from terminal.
visit the url by adding /public to it.
Optional
Setup virtual host by editing httpd-vhosts.conf file (so you can avoid typing /public in the url) and adding following to it
<VirtualHost example.dev:80>
DocumentRoot "C:/xampp/htdocs/laravel/public"
ServerName example.dev
</VirtualHost>
then edit your host file and add following to it:
127.0.0.1 example.dev
You can replace example.dev with whatever URL you like.
You can use Laravel Homestead
https://laravel.com/docs/5.4/homestead
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine.
You should give a look on Laravel's documentation.
This the best way to understand Laravel.
If you just get the source code you'll need to do some things :
Copy .env.example and rename it .env
Edit .env file to fit on your needs like database informations
Run composer install to install dependencies
Run php artisan key:generate
Assuming you are using xampp on Windows as localhost. Now go to path/to/xampp/htdocs then open git terminal by right click on Git Bash Here
Now run following commands:
1. git clone https://github.com/fakharkhan/laravel-school-erp
2. cd laravel-school-erp
3. composer install
4. cp .env.example .env
5. php artisan key:generate
For database connection: make a database and set (DB_DATABASE, DB_USERNAME, DB_PASSWORD) values to .env file (which is in your project root).
And finally browse: localhost/laravel-school-erp/public

How to run Laravel project without php artisan serve in laravel 5.3

I have updated the PHP version to 5.6.3 and create a project using laravel 5.3.0 . Now i want to run my project without php artisan serve. When i hit localhost , the index page is opened. But when i click one my project name it shows following error.
****The localhost page isn’t working****
Note that i have tried following method to get rid of this issue.
1. copy .htaccess file from public directory to project folder
2. rename the server.php to index.php
But it is not working. Any ideas in this regard?
If you using LAMP and you want to run Laravel project without Artisan, you have to navigate from browser to /laravel/public directory. Follow laravel documentation https://laravel.com/docs/4.2/quick
But if you getting errors like 500 and your page don't work, possibly you have to change permissions of your Laravel project directory.
Try sudo chmod -R 770 /path/to/your/laravel/project
or sudo chmod -R 775 /path/to/your/laravel/project
for more refer with this https://help.ubuntu.com/community/FilePermissions

Blank page with php artisan serve for laravel 5 in mamp php 5.4.10

I am trying to install Laravel for first time. I installed it on my desktop with the following composer command
composer create-project laravel/laravel laravel-app
The command completed successfully without any error but with some messages like
symfony/var-dumper suggests installing ext-symfony_debug ()
symfony/translation suggests installing symfony/config ()
I now did chmod -R 777 larvel-app to make whole folder writable by everyone. I now started php server with following command
cd laravel-app
php artisan serve
and it gave following message
Laravel development server started on http://localhost:8000
When viewed from web browser in address http://localhost:8000, there is nothing, only blank page. When I browse this address, the server seems to quit.
I have following environment:
OSX Mavericks;
MAMP with php 5.4.10 and apache2;
following extensions in php.ini file
extension=imap.so
extension=yaz.so
extension=mcrypt.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so
extension=pdo_mysql.so
;;;;;Following are added by me ;;;;no error when starting server
extension=openssl.so
extension=mbstring.so
When I run which php from command line, I get following.
/Applications/MAMP/bin/php/php5.4.10/bin/php
When I tried to run this in mamp ie localhost:8888, it gave 500 internal server error.
Please suggest me, where I might have made mistake.
As a OSX user i strongly recommend you to use Laravel Homestead to develop your applications.
http://laravel.com/docs/5.0/homestead
You only need to install:
Virtualbox
Vagrant
I have my projects in ~/code folder, so everytime i create a new project, i just:
Add project test domain to my local host file (my-project.app pointing to localhost 127.0.0.1)
ssh into the homestead virtualmachine (homestead ssh)
run built in serve command (serve my-project.app /path/to/project/public)
Voilà
The most common reason for this is that the web server process does not have write access to the storage folder and its subfolders.
Set the permissions on the storage folder so that the web server can create files.
You don't have to use php serve, mamp does that for you. Make sure you point your directory to public folder. You can also use custom domain for each of your projects.
Also for Mac there is laravel valet. Easy to get started with many php projects.
I think you should move your Laravel Application to
/Applications/MAMP/htdocs/
and then you can access it on
http://localhost:8888/laravel-app

Categories