Is there any way to move config app (app/config) above the app folder?
I want to deploy app folder without override config files on multiple instances of my app.
I am not sure if that is possible. What you can do is adding a (set of) custom config(s) to you config.php's always_load section. You can add custom paths so that it can be loaded from any file, even outside of your application.
While this (partly) solves your problem, I might have a better solution for you:
You can configure your application per environment. APPPATH/config/production/*.php will override your default configuration. If you don't want to version control this folder, you can add it to .gitignore. If your deployment process is smart enough, you can configure to preserve configuration files between deployments. To activate production environment, you need to set the FUEL_ENV environment variable to production.
Related
I want to deploy my Laravel project which has a Per-project Homestead inside it (not the global homestead). Some Vagrant and all Homestead files are included inside my Laravel project. This is the first time I'm deploying a Laravel application, and I really cannot find any information about files and folders that may be excluded from the deployment (Especially for a project with a per-project Homestead inside it).
I guess, .vagrant, tests, .env.example, .gitattributes, .gitignore, after.sh, aliases, Homestead.yaml, phpunit.xml, readme.md, and Vagrantfile files and folders may be excluded. Am I right? And what about the vendor folder (There are some Vagrant, Homestead files inside, as well, like e.g. homestead, homestead.bat inside the vendor/bin folder, or the whole homestead folder inside vendor/laravel).
Ideally, you would use a VPS or deployment server like DigitalOcean. However, as you stated you are using a shared server, the directories/files you will need to upload to the root directory of your server account are:
app/*
bootstrap/*
config/*
database/*
public_html/*
resources/*
routes/*
storage/*
vendor/*
.env
The remaining .files are for dependency management and development tests, and since you likely won't be using any build processes or Continuous Integration on a shared server, you won't need them.
Note: make sure these are in the root directory and the only publicly accessible directory is public_html. By default, shared hosting servers already have this restriction. Uploading the Laravel project as you have it will overwrite the website's current public_html directory, so make sure to back up anything you may have there currently.
Update
Frameworks like Laravel are designed to use root/command-line access to assist with deployment and server management. This is the advantage of frameworks. Shared servers do not typically allow users root access, so you end up having issues like yours, where deployment is a manual upload instead of a CLI command through version control.
vendor contains all of the dependencies your app is relying on to operate (Eloquent, Doctrine, Flysystem, etc.), so it won't work without the vendor directory.
You should deploy from version control, and by default that should exclude .vagrant and Homestead.yaml everything else is safe to leave in.
I am a beginner PHP , I found out that Laravel has .env file to save some configurations and php also have a file format .ini to save config.
I want to ask what is the difference in both, is one is better from another. Should i add dotenv in my core projects also or should i create class/function to access .ini for my config/environment variables.
i want to understand why dotenv is being created as we already had ini file extension system in php?
I think there are too many smartasses with nothing else to do. I will use parse_ini_file() and *.ini files. Everything is the same !
.env allows loading the configuration to the system environment. Straight loading of INI files does not do this unless you roll your own solution using putenv or similar for all the configuration values. Otherwise you could whichever approach you wish.
According to the docs at https://github.com/vlucas/phpdotenv
Why .env?
You should never store sensitive credentials in your code. Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments – such as database credentials or credentials for 3rd party services – should be extracted from the code into environment variables.
Basically, a .env file is an easy way to load custom configuration variables that your application needs without having to modify .htaccess files or Apache/nginx virtual hosts. This means you won't have to edit any files outside the project, and all the environment variables are always set no matter how you run your project - Apache, Nginx, CLI, and even PHP 5.4's built-in webserver. It's WAY easier than all the other ways you know of to set environment variables, and you're going to love it.
NO editing virtual hosts in Apache or Nginx
NO adding php_value flags to .htaccess files
EASY portability and sharing of required ENV values
COMPATIBLE with PHP's built-in web server and CLI runner
Additionally, there is some extended functionality with Laravel's .env file. For example, you can reference other variables inside the .env file.
MAIL_USERNAME=admin#server.com
MAIL_FROM_ADDRESS=${MAIL_USERNAME}
I am trying to deploy a Lithium app on Heroku, but Heroku uses a read-only file system for apps. This causes a problem with the app/resources folder. I've tried looking for a setting the lithium config to change the path to this folder, but it appears to be hard coded.
Can anyone recommend how to resolve this issue?
Lithium uses the /resources folder for writing temporary files such as logs, file caches, compiled PHP templates, etc.
The path is configurable through Libraries::add() when the application is initialized. In config/bootstrap/libraries.php, you can replace your application's Libraries::add() call with one like the following: https://github.com/orchestra-io/sample-lithium/blob/master/app/config/bootstrap/orchestra.php#L10
This configuration uses the system's temp directory, and checks for/initializes the subdirectories Lithium will use.
I'm not sure if I'm missing the point here...
Our devs want the following...
On a LAMP server with SVN/WebDAV they want the root Apache directory to be a repository that they can all work on. However, setting the default Apache directory to a repo doesn't work as the files aren't stored as html/php files, instead in the SVN db structure to handle changes/revisions/etc.
Is there any way to do this? or would we have to have a separate repo that they copy files to/from the web root when developing?
You have to setup a separate svn repository and Hook Scripts. This hook scripts can checkout the code on every code change to your apache root. This is quite common an also used for automatic testing etc.
I am about to start a CodeIgniter based project and plan on using Git as our DVCS. I will be working with a few other developers, and the central (origin) server is privately hosted. But I also want to open source it and publish the code to Github later.
My question is, is there a way to separate the config file(s) in Git, so that the private information in the config file is not sent to the Github remote but is to origin and other peers.
Another question is could we use a similar solution for having local development config files and a server one for production?
Create the files config.php.sample and database.php.sample that each of your developers will use that has a placeholder for the passwords and other sensitive information. Add config.php and database.php to your .gitignore
The first time you deploy to the production site, you'll create the config.php and database.php files. Subsequent pushes won't overwrite config.php and database.php since they're not included in the git repository.
Codeigniter has some support for environments (Development, Production, etc).
Refer to official documentation , CodeIgniter Environments.
Regarding config files, you can use .gitignore
http://progit.org/book/ch2-2.html
Edit:
Since you have used github tag in the question; Github now has an option to add .gitignore file (they have a codeigniter template too )
You should use a deployment tool to set the config file when deploying your application to the destination system.
capistrano with railsless-deploy is a good option