Laravel project doesn't start on subfolders - php

I have a problem, I wrote an application but it doesn't work on sub folder. I have to prepare my program to work in sub folders. For example:
127.0.0.1/ - here is my project at the beginning, when I create it, but when someone start in like this:
127.0.0.1/store - then it doesn't work, how to fix it and where do this? Somewhere in config?

I think the setup is wrong, there are different ways to boot laravel on localhost
1. Run the following command from the project root directory
php artisan serve then go to 127.0.0.1:8000
php artisan serve --port=8080 to change the port
2. Access it from localhost by
go to -> xampp(if you're using xampp) -> htdocs
mkdir (create a folder) "store"
then cd into the folder, run the following command
composer create-project --prefer-dist laravel/laravel .
go to -> 127.0.0.1/store/public

Related

How add Artisan cli to existing laravel project?

I have issue with Artisan usage on Windows 10 with Xampp.
What have I done:
clone project from git repositiory
run composer install
In directory with project i trying run:
php artisan
but i get errror:
Could not open input file: artisan
But if i run command
php bin/console i get list of command like cache, debug, eloquent... so some tools are there... But none artisan...
How i can add/use artisan into existing project?
Check if artisan file exists in your project root folder. If it does, then you're probably on the wrong folder. If it doesn't exist, you can just download it from the official repo.
To configure an existing project, you'd typically check those things first :
You should goto app/config/database.php check file and verify username and password.
After check in Project Folder vendor folder and composer.json file exist then remove it (that remove old configuration now we going to fresh configuration).
Then after back to command prompt and fire command composer update and that download some dependent file download.
Now Run php artisan serve

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

Phinx init does not work

I would like to install Phinx db migrations in my project, but documentation commands do not work. At first it is impossible to run
php vendor/bin/phinx init
because phinx is not php commant. Ok so I went to bin directory and run phinx.bat but this generated the yaml config file to bin folder not to the root dir as they says in documentation, but to the bin directory. What should I do to get correct installation?
So the problem is I am on Windows and I need to write Windows separator so this command works: vendor\bin\phinx init

Laravel Homestead Installation Error on Windows

I have been trying to set up Laravel Homestead Environment on a local machine. But I was unable to do it.I faced several errors in the installation process. Actually,I am confused with the installation procedure from configuring the SSH Key in the "homestead.yaml" file step.
In the "homestead.yaml" file,How to configure the authorize and keys components according to my local SSH file location against the standard Absolute Path location?
And what exactly is the use of Composer which is being mentioned as a package managing tool?
Is there a good tutorial out there regarding the installation procedure?
Its the first task in my new job and I am really struggling. Any help is really appreciated.
Thanks,
Sri
As you're asking for SSH i assume that you already downloaded Homestead completely (box & clone)and that a Homestead folder is present in you home directory.
First make sure you have Git Bash installed if you're on Windows, Go to your Homestead folder, right click and chose Git Bash then type in this command ssh-keygen -t rsa -C "you#homestead" this will create an SSH key in your folder.
You have to make sure that the keys are named like id_rsa.pub and id_rsa and place them in C:/Users/{username}/.SSH if they're somewhere else, install Composer if you don't have yet go to the folder you want laravel to be in, right click use composer here in next window put this command composer create-project laravel/laravel --prefer-dist
For your authorize key path question this is what you need to put in the Homestead.yaml file authorize: C:/Users/{username}/.ssh/homestead_rsa.pub
for the folders :
folders:
- map: C:/path/to/{local_laravel_project_folder}
to: /home/vagrant/Code
type: "nfs"
sites:
- map: sitename.dev
to: /home/vagrant/Code/Laravel/public
hhvm: true
Open notebook with administrative rights and go to C:\Windows\System32\drivers\etc\hosts and add this line 192.168.10.10 : sitename.dev save the file, run Homestead then in Bash put this command vagrant upand you should see the laravel homepage when you visit sitename.dev .

Categories