Laravel | Deployer and automatic deploy with gitlab ci - php

i want to setup automatic deploy to my production server.
This is my log from gitlab ci ->
Running with gitlab-runner 11.9.0-rc2 (227934c0)
on docker-auto-scale fa6cab46
Using Docker executor with image lorisleiva/laravel-docker:latest ...
Pulling docker image lorisleiva/laravel-docker:latest ...
Using docker image sha256:4bd5ecacba7b0f46950944f376647090071a70a7b1ffa0eacb492719bd476c6b for lorisleiva/laravel-docker:latest ...
Running on runner-fa6cab46-project-11286864-concurrent-0 via runner-fa6cab46-srm-1552945620-f480ce3e...
Initialized empty Git repository in /builds/Woblex/web/.git/
Fetching changes...
Created fresh repository.
From https://gitlab.com/Woblex/web
* [new branch] master -> origin/master
Checking out ce51a64e as master...
Skipping Git submodules setup
Downloading artifacts for composer (179849020)...
Downloading artifacts from coordinator... ok id=179849020 responseStatus=200 OK token=zy8-CGce
Downloading artifacts for npm (179849021)...
Downloading artifacts from coordinator... ok id=179849021 responseStatus=200 OK token=NvUWyzkg
$ eval $(ssh-agent -s) # collapsed multi-line command
Agent pid 11
Identity added: (stdin) (git#gitlab.com)
$ find . -type f -not -path "./vendor/*" -exec chmod 664 {} \; # collapsed multi-line command
$ whoami
root
$ php artisan deploy woblex.cz -s upload
✈︎ Deploying HEAD on woblex.cz with upload strategy
➤ Executing task deploy:prepare
✔ Ok
➤ Executing task deploy:lock
✔ Ok
➤ Executing task deploy:release
✔ Ok
➤ Executing task deploy:update_code
➤ Executing task deploy:failed
✔ Ok
➤ Executing task deploy:unlock
✔ Ok
In Client.php line 99:
The command "cd /var/www/dev.woblex.cz && (/usr/bin/git clone --recursive
git#gitlab.com:Woblex/web.git /var/www/dev.woblex.cz/releases/1 2>&1)" fa
iled.
Exit Code: 128 (Invalid exit argument)
Host Name: woblex.cz
================
Warning: Identity file /home/gitlab/.ssh/id_rsa not accessible: No such fil
e or directory.
deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]
In Process.php line 239:
The command "vendor/bin/dep --file=vendor/lorisleiva/laravel-deployer/.buil
d/deploy.php deploy 'woblex.cz'" failed.
Exit Code: 128(Invalid exit argument)
Working directory: /builds/Woblex/web
Output:
================
✈︎ Deploying HEAD on woblex.cz with upload strategy
➤ Executing task deploy:prepare
✔ Ok
➤ Executing task deploy:lock
✔ Ok
➤ Executing task deploy:release
✔ Ok
➤ Executing task deploy:update_code
➤ Executing task deploy:failed
✔ Ok
➤ Executing task deploy:unlock
✔ Ok
Error Output:
================
In Client.php line 99:
The command "cd /var/www/dev.woblex.cz && (/usr/bin/git clone --recursi
ve
git#gitlab.com:Woblex/web.git /var/www/dev.woblex.cz/releases/1 2>&1)"
fa
iled.
Exit Code: 128 (Invalid exit argument)
Host Name: woblex.cz
================
Warning: Identity file /home/gitlab/.ssh/id_rsa not accessible: No such f
il
e or directory.
deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles
ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]
ERROR: Job failed: exit code 1
I there is my deploy.php configuration ->
<?php
return [
/*
|--------------------------------------------------------------------------
| Default deployment strategy
|--------------------------------------------------------------------------
|
| This option defines which deployment strategy to use by default on all
| of your hosts. Laravel Deployer provides some strategies out-of-box
| for you to choose from explained in detail in the documentation.
|
| Supported: 'basic', 'firstdeploy', 'local', 'pull'.
|
*/
'default' => 'basic',
/*
|--------------------------------------------------------------------------
| Custom deployment strategies
|--------------------------------------------------------------------------
|
| Here, you can easily set up new custom strategies as a list of tasks.
| Any key of this array are supported in the `default` option above.
| Any key matching Laravel Deployer's strategies overrides them.
|
*/
'strategies' => [
//
],
/*
|--------------------------------------------------------------------------
| Hooks
|--------------------------------------------------------------------------
|
| Hooks let you customize your deployments conveniently by pushing tasks
| into strategic places of your deployment flow. Each of the official
| strategies invoke hooks in different ways to implement their logic.
|
*/
'hooks' => [
// Right before we start deploying.
'start' => [
//
],
// Code and composer vendors are ready but nothing is built.
'build' => [
//
],
// Deployment is done but not live yet (before symlink)
'ready' => [
'artisan:storage:link',
'artisan:view:clear',
'artisan:cache:clear',
'artisan:config:cache',
'artisan:migrate',
'artisan:horizon:terminate',
],
// Deployment is done and live
'done' => [
//
],
// Deployment succeeded.
'success' => [
//
],
// Deployment failed.
'fail' => [
//
],
],
/*
|--------------------------------------------------------------------------
| Deployment options
|--------------------------------------------------------------------------
|
| Options follow a simple key/value structure and are used within tasks
| to make them more configurable and reusable. You can use options to
| configure existing tasks or to use within your own custom tasks.
|
*/
'options' => [
'application' => env('APP_NAME', 'Laravel'),
'repository' => 'git#gitlab.com:Woblex/web.git',
'git_tty' => false,
],
/*
|--------------------------------------------------------------------------
| Hosts
|--------------------------------------------------------------------------
|
| Here, you can define any domain or subdomain you want to deploy to.
| You can provide them with roles and stages to filter them during
| deployment. Read more about how to configure them in the docs.
|
*/
'hosts' => [
'woblex.cz' => [
'deploy_path' => '/var/www/dev.woblex.cz',
'user' => 'gitlab',
'identityFile' => '/home/gitlab/.ssh/id_rsa',
],
],
/*
|--------------------------------------------------------------------------
| Localhost
|--------------------------------------------------------------------------
|
| This localhost option give you the ability to deploy directly on your
| local machine, without needing any SSH connection. You can use the
| same configurations used by hosts to configure your localhost.
|
*/
'localhost' => [
//
],
/*
|--------------------------------------------------------------------------
| Include additional Deployer recipes
|--------------------------------------------------------------------------
|
| Here, you can add any third party recipes to provide additional tasks,
| options and strategies. Therefore, it also allows you to create and
| include your own recipes to define more complex deployment flows.
|
*/
'include' => [
//
],
/*
|--------------------------------------------------------------------------
| Use a custom Deployer file
|--------------------------------------------------------------------------
|
| If you know what you are doing and want to take complete control over
| Deployer's file, you can provide its path here. Note that, without
| this configuration file, the root's deployer file will be used.
|
*/
'custom_deployer_file' => false,
];
I think that there is a problem with user connected to my ubuntu server from laravel deployer, because i set in config the username to 'gitlab', but if deployer connect to ubuntu server with this user it can see a file /home/gitlab/.ssh/id_rsa. Have anybody someting, that can help me? Thanks a lot!
Edit: Here my gitlab-ci.yml
image: lorisleiva/laravel-docker:latest
.init_ssh: &init_ssh |
eval $(ssh-agent -s)
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh
chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# Replace the last line with the following lines if you'd rather
# leave StrictHostKeyChecking enabled (replace yourdomain.com):
#
# ssh-keyscan yourdomain.com >> ~/.ssh/known_hosts
# chmod 644 ~/.ssh/known_hosts
.change_file_permissions: &change_file_permissions |
find . -type f -not -path "./vendor/*" -exec chmod 664 {} \;
find . -type d -not -path "./vendor/*" -exec chmod 775 {} \;
composer:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-composer
paths:
- vendor/
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.example .env
- php artisan key:generate
artifacts:
expire_in: 1 month
paths:
- vendor/
- .env
npm:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-npm
paths:
- node_modules/
script:
- npm install
- npm run production
artifacts:
expire_in: 1 month
paths:
- node_modules/
- public/css/
- public/js/
#codestyle:
# stage: test
# dependencies: []
# script:
# - phpcs --standard=PSR2 --extensions=php --ignore=app/Support/helpers.php app
phpunit:
stage: test
dependencies:
- composer
script:
- phpunit --coverage-text --colors=never
staging:
stage: deploy
script:
- *init_ssh
- *change_file_permissions
- whoami
- php artisan deploy woblex.cz -s upload
environment:
name: staging
url: http://www.dev.woblex.cz
only:
- master
production:
stage: deploy
script:
- *init_ssh
- *change_file_permissions
- php artisan deploy new.woblex.cz -s upload
environment:
name: production
url: https://www.new.woblex.cz
when: manual
only:
- master

Related

grumphp not working correclty with custom directory structure

For some reason grumphp not working for me as expected.
First of all my project directory structure is:
.git/
devops/
app/
src/
confing/
bin/
vendor/
grumphp.yml
phpcs.xml
...
so I in the git repo I have some docker related files in the devops folder, and symfony app int the app folder, also in app folder I have grumphp and all linters configs.
I want to run grumphp from inside of the docker container when I commit some changes to check if my code is correct.
Here is my grumphp.yml
grumphp:
environment:
variables:
GRUMPHP_PROJECT_DIR: "."
GRUMPHP_GIT_WORKING_DIR: "../"
GRUMPHP_BIN_DIR: "vendor/bin/"
GRUMPHP_GIT_REPOSITORY_DIR: "../.git/"
git_hook_variables:
EXEC_GRUMPHP_COMMAND: docker exec php-fpm
stop_on_failure: false
ignore_unstaged_changes: false
hide_circumvention_tip: false
process_timeout: 6
tasks:
composer: ~
phpcs:
standard: phpcs.xml
ignore_patterns: [./var/*, ./public/*, ./config/*, ./bin/*]
phpcsfixer2:
config: .php_cs
phpstan:
autoload_file: ./bin/.phpunit/phpunit-9.0.1-0/vendor/autoload.php
memory_limit: "-1"
git_commit_message:
allow_empty_message: false
enforce_capitalized_subject: false
enforce_no_subject_punctuations: false
enforce_no_subject_trailing_period: true
enforce_single_lined_subject: true
type_scope_conventions: []
max_body_width: 0
max_subject_width: 72
matchers:
Must contain JIRA issue number: /^(Merge)|([A-Z_0-9]+-[0-9]+)/
case_insensitive: true
multiline: true
additional_modifiers: ''
yamllint:
whitelist_patterns: [ ]
ignore_patterns:
- /^vendor\/(.*)/
object_support: false
exception_on_invalid_type: false
parse_constant: false
parse_custom_tags: false
testsuites:
pre-commit:
tasks:
- composer
- phpcs
- phpcsfixer2
- phpstan
- yamllint
- git_commit_message
and when I'm running vendor/bin/grumphp git:init from inside of the docker container, pre-commit file generated in the .git/hooks directory, generated pre-commit file content:
#!/bin/sh
#
# Run the hook command.
# Note: this will be replaced by the real command during copy.
#
# Fetch the GIT diff and format it as command input:
DIFF=$(git -c diff.mnemonicprefix=false -c diff.noprefix=false --no-pager diff -r -p -m -M --full-index --no-color --staged | cat)
# Grumphp env vars
export GRUMPHP_GIT_WORKING_DIR="$(git rev-parse --show-toplevel)"
# Run GrumPHP
(cd "app/" && printf "%s\n" "${DIFF}" | docker exec php-fpm 'vendor/phpro/grumphp/bin/grumphp' 'git:pre-commit' '--skip-success-output')
SO what is the issue?
When I run git commit having php files with a broken styles, grumphp telling that all is fine and allowing me to commit this files, but when I run vendor/bin/grumphp run from inside of the container all working fine and I see list of all the issues I need to fix.
So why all linters checks passing on commit when they should not, but when I'm running vendor/bin/grumphp run it's working as expected?
I'm not sure but I think it somehow related to my directory structure, I have .git in the root of repository, but symfony and grumphp.yml in the app directory.
Thanks in advance!

failed opening required in laravel warning and fatal error

laravel giving error failed opening required thrn (file path)(include_path='C:\xampp\php\PEAR')in (file path)
//my index file code id shown below
//require __DIR__.'public/vendor/autoload.php';
require_once $_SERVER['DOCUMENT_ROOT'].'public/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
//$app = require_once __DIR__.'/public/bootstrap/app.php';
$app = require_once (realpath($_SERVER["DOCUMENT_ROOT"]).'/public/bootstrap/app.php';
If this is a new installation, you need to run composer install.
If it's an existing installation (vendor folder exists) run composer update.
Step 1:
Run: Composer Install for new Installation.
Run: Composer Update for Existing Installation.
Step 2: Make .env file
Step 3: Run: Php artisan migrate (Make database )
Step 4: Run: Php artisan key:generate

Continuous Integration and Development with Laravel

I'm new to Laravel, currently working on my first project. I have worked with CI before but never with Laravel. So, here's my deploy script for our Dev server. Not sure if this is the best approach. Anyway, the migrate part is giving me an error. After I get this to work I will try some php plugins to analyze code quality, duplication, unit tests, etc.
Please, see below
Script:
rsync -a . /var/www/html/dev/
cd /var/www/html/dev/
# cfg file for dev
cp .env.dev .env
# run composer
composer clearcache
composer install --optimize-autoloader
# optimize
php artisan cache:clear
php artisan optimize
php artisan route:cache | true
# migrate DB
php artisan migrate
Error:
[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists:
Am I supposed to delete all my tables before doing the migration? If so, I don't see what's the useful part of using them for auto deployment. Besides, we have our tables filled with data for testing (manually filled as we don't want to auto seed).
You shouldn't delete all your tables before run migration.
This error come from your migrations table and your migrations at database\migrations folder have conflict.
You should resolve this conflict before return to continue configure Jenkins.
My suggestion:
You should use Rocketeer for control release versions of your projects.
You can share your .env file by shared folder.
You can run composer install and npm install by default configure of Rocketeer.
Here is my steps install and configure Rocketeer:
Install Rocketeer:
$ wget http://rocketeer.autopergamene.eu/versions/rocketeer.phar
$ chmod +x rocketeer.phar
$ mv rocketeer.phar /usr/local/bin/rocketeer
//TODO Install PHP for Jenkins server
$ sudo apt-get install php
//TODO Check rocketeer
$ rocketeer check
No connections have been set, please create one: (production) <~ Succeed
Setup remote server information
$ cd /var/lib/jenkins/drone-deploy/drone-deploy/server-dev
$ rocketeer ignite
No connections have been set, please create one: (production)develop
No host is set for [develop], please provide one:35.166.x.x
No username is set for [develop], please provide one:ec2-user
No password or SSH key is set for [develop], which would you use? (key) [key/password]key
Please enter the full path to your key (/var/lib/jenkins/.ssh/id_rs/var/lib/jenkins/.ssh/xxx.pem
If a keyphrase is required, provide it
No repository is set for [repository], please provide one:git#bitbucket.org:xx/xxxxxx.git
No username is set for [repository], please provide one:xxx
No password is set for [repository], please provide one:
develop/0 | Ignite (Creates Rocketeer's configuration)
What is your application's name ? (drone-php)drone_deploy
The Rocketeer configuration was created at server-dev/.rocketeer
Configure
$ cd /var/lib/jenkins/drone-deploy/drone-deploy/drone-php
$ nano .rocketeer/config.php
Replace connections name production --> develop //It's Rocketeer bug
$ nano .rocketeer/remote.php
'root_directory' => '/var/www/html/',
'shared' => [
'storage/logs',
'storage/framework/sessions',
'.env',
],
'permissions' => [
// The folders and files to set as web writable
'files' => [
//'app/database/production.sqlite',
'bootstrap',
'storage',
'public',
],
// Here you can configure what actions will be executed to set
// permissions on the folder above. The Closure can return
// a single command as a string or an array of commands
'callback' => function ($task, $file) {
return [
sprintf('chmod -R 777 %s', $file),
sprintf('chmod -R g+s %s', $file),
sprintf('chown -R ec2-user:ec2-user %s', $file),
];
},
],
$ nano .rocketeer/strategies.php
//'test' => 'Phpunit',
'test' => '',
//return $composer->install([], ['--no-interaction' => null, '--no-dev' => null, '--prefer-dist' => null]);
return $composer->install([]);
Running test
rocketeer deploy --on="develop" --tests

.env/user_vars Environment Variables are returning NULL

I am trying to setup Laravel 5.2 on Openshift using
https://github.com/boekkooi/openshift-cartridge-php
https://github.com/boekkooi/openshift-cartridge-nginx
I am able to set the user variables like APP_DEBUG using action_hooks, but these environment variables are returning NULL in Laravel files. Please suggest a way to solve this problem! What am I missing that is not reading the variables in .env/user_vars/ directory.
EDIT 1:
Following is the code snippet of action_hooks/deploy
echo "Setting environment variables..." 1>&2
export APP_ENV="${APPLICATION_ENV:-production}"
if [[ "${APPLICATION_ENV:-}" != "development" ]]; then
export APP_DEBUG=false
else
export APP_DEBUG=true
fi
echo "App Debug Mode '$APP_DEBUG' '$APP_ENV'..." 1>&2
if [ "$(type -t set_env_var)" == "function" ]; then
set_env_var 'APP_ENV' $APP_ENV $OPENSHIFT_HOMEDIR/.env/user_vars
set_env_var 'APP_DEBUG' $APP_DEBUG $OPENSHIFT_HOMEDIR/.env/user_vars
fi
if [ ! -z "$OPENSHIFT_APP_DNS" ]; then
export APP_URL="$OPENSHIFT_APP_DNS"
echo "App URL '$APP_URL' '$OPENSHIFT_APP_DNS'..." 1>&2
if [ "$(type -t set_env_var)" == "function" ]; then
set_env_var 'APP_URL' $APP_URL $OPENSHIFT_HOMEDIR/.env/user_vars
fi
fi
if [ ! -z "$OPENSHIFT_SECRET_TOKEN" ]; then
export APP_KEY=davjhdfgdhayufgahgajgfdshadjaj
echo "App KEY '$APP_KEY' '$OPENSHIFT_SECRET_TOKEN'..." 1>&2
if [ "$(type -t set_env_var)" == "function" ]; then
set_env_var 'APP_KEY' $APP_KEY $OPENSHIFT_HOMEDIR/.env/user_vars
fi
fi
echo "App Debug Mode '$APP_DEBUG' '$APP_ENV'..." 1>&2
echo "App KEY '$APP_KEY' '$OPENSHIFT_SECRET_TOKEN'..." 1>&2
Followed by the rest of code...
The output for this while deploying gives me
remote: Setting environment variables...
remote: App Debug Mode 'true' 'development'...
remote: App URL 'laravel-narsariamanu.rhcloud.com' 'laravel-narsariamanu.rhcloud.com'...
remote: App KEY 'davjhdfgdhayufgahgajgfdshadjaj' 'Ifm2BJ_o9pvLMyEykfwApI5FRLsZ5BZyGI54m2Lqu46XLLtx4aOWjFKYGfTOL3hhkRvm6dSLFmSHBP5xTKgAdtChXYXr6HEgq92qco4dC4fE-CkQR-82RV7UYE0N7_nq'...
remote: App Debug Mode 'true' 'development'...
remote: App KEY 'davjhdfgdhayufgahgajgfdshadjaj' 'Ifm2BJ_o9pvLMyEykfwApI5FRLsZ5BZyGI54m2Lqu46XLLtx4aOWjFKYGfTOL3hhkRvm6dSLFmSHBP5xTKgAdtChXYXr6HEgq92qco4dC4fE-CkQR-82RV7UYE0N7_nq'...
remote:
remote: Database driver set to 'mysql'...
remote: Database set to '127.5.76.2' 'mysql' 'laravel' 'admin4QlGeTU' '7eTw_XGG4dSx'...
remote: OPENSHIFT Database set to '127.5.76.2' 'mysql' 'laravel' 'admin4QlGeTU' '7eTw_XGG4dSx'...
remote:
remote:
remote: Migrating storage and log directories...
remote:
remote:
remote: Running 'php artisan migrate --force'...
remote:
remote: Nothing to migrate.
remote: Checking configuration
remote: - php-fpm.ini: No change
remote: - php-fpm.conf: No change
remote: - php.ini: No change
remote: PHP-FPM already running
remote: Nginx instance is started
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
In config/app.php in Laravel :
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
This env('APP_KEY') returns NULL, though while deploying it is set.
Please help me how to solve this problem.
Sometimes when you changed in your .env file it does not take correct values from that, the problem is due to some configuration cache.Try running following commands, hope will work
php artisan config:cache //cached all files under config directory
php artisan config:clear //repopulate all the env variable and clear config cache
php artisan cache:clear //flush all the cached content (route, view, config cache)
It might be a little late but here is the answer. https://github.com/laravel/framework/issues/8191
As a summary it is suggested to set the value in your config file(I reference them to my env file). then you can call from config files.
\Config::get('app.env') instead of env('APP_ENV') and in my app.php file in config folder I set:
'env' => env('APP_ENV', 'production'),
php artisan config:cache did not solve my problem.
I hope it help you guys.
cheers.
In your php.ini file check your variables_order. IF it reads "GPCS" try adding E to the beginning and restart your server, then see what happens.
If any of the lines in .env have spaces and aren't enclosed in " then it'll fail.
Some things to try
Check the permissions for your .env file. Try setting it to 777 as a
test, to see what will happen. (if that works, don't keep it at 777)
Run php artisan config:cache, and php artisan config:clear command.
restart your app server.

unable to live site in server laravel5

iam getting an error after uploaded project to server. when i visited to link somedomain.com/DEMO i got following error. What actually is this error? how can i solve it please help me.
Warning: require(/home/siddins/public_html/DEMO/project/app/http/helpers/backend/helpers.php): failed to open stream: No such file or directory in /home/siddins/public_html/DEMO/project/vendor/composer/autoload_real.php on line 54
Fatal error: require(): Failed opening required '/home/siddins/public_html/DEMO/project/app/http/helpers/backend/helpers.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/siddins/public_html/DEMO/project/vendor/composer/autoload_real.php on line 54
my index.php is like this:
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* #package Laravel
* #author Taylor Otwell <taylorotwell#gmail.com>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/
require __DIR__.'/project/bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/project/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
project is main folder . Inside projetc i have app,vendor,bootstrap,config,database,resources etc
Here are some of the best practices while launching a Laravel app on server.
Try them out. Might solve your issues. These steps have solved almost every problem that I have faced till now while launching a site on server.
1.Enable Mod_Rewrite
a2enmod rewrite
2.Install php 5.6
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
While returning views, always use Foldername.viewname instead of Foldername\viewname
use public_path() while including files
chmod -R 777 "Storage folder path"
This file doesn't exist:
/home/siddins/public_html/DEMO/project/app/http/helpers/backend/helpers.php

Categories