New files on installation of project Symfony 3 - php

I've installed a Symfony project on Windows (developed on a Mac) and after composer install I got 3 new files :
bin/symfony_requirements
var/SymfonyRequirements.php
web/config.php
Do I need to version those files or ignore them in the .gitignore file ?

web/config.php
From SensioLabsInsight,
This config.php file should only be used to bootstrap a Symfony application. Before releasing to production, you should remove it, otherwise attackers could get valuable insight about your application.
var/SymfonyRequirements.php
This file is used by Symfony Check CLI Script to check for minimum requirements of configuring & running a Symfony App. It's a Common Post-Deployment Task.
See this question Should the changes of SymfonyRequirements.php be included in version control? and the documentation.

No need to add these files in git.
I use .gitignore as like this and its working fine for me and my team.
/web/assetic/
/web/bundles/*
/var/bootstrap.php.cache
/var/cache/*
/var/sessions/*
/app/config/parameters.yml
/var/logs/*
/vendor/
/bin/
/web/uploads/
/.project
/.buildpath
/.settings

Related

Laravel home page is not displaying correctly

I have my laravel project installed using homestead and I connect to it via SSH using Vagrant(on Windows). The first time I launched my project there was a message indicating i have an error in my public/index.php file indicating that directory specified in 'require' on 14 line is not found it was written like this
require __DIR__.'/../vendor/autoload.php';
then I just replaced this line of code with directory of welcome.blade.php file (require .../welcome.blade.php) (the home page of Laravel) and this page displayed each time I went to my project website but there was another message displayed saying
Illuminate\Foundation\Application' not found in
/home/vagrant/code/myProject/bootstrap/app.php on line 14.
I think that is because of the laravel version installed enter image description here
What I find quite suspicious is that I haven't got env file and vendor folder inside my project folder. vendor folder was located in AppData/Roaming/Composer folder by default. I just moved that folder to my project folder
First thing, Revert the changes within public/index.php back to how it was. That deals with autoloading and bootstrapping the laravel application and should never really be changed.
Now ssh to your vagrant box and within the laravel project, run cp .env.example .env and then edit the newly copied .env file to have all your details for DATABASE and APP_NAME.
Next, go into your project, and run composer install and this will install all the needed dependencies from the composer.json file.
And lastly, from within your project, you should now run php artisan key:generate to generate the APP_KEY.
This should fix your issue.
I would also advice that you look carefully over the documentation at https://laravel.com/docs

Setup a local configuration file in Codeigniter

Probably my English is not the best,i will try to re-explain.
SERVER ROOT
—> global_application_folder
-> global_system_folder
—> app_1
- index.php
- local_config_file.php
- local_database_file.php
-> app_2
- index.php
- local_config_file.php
- local_database_file.php
-> app_3
- index.php
- local_config_file.php
- local_database_file.php
In any folder app_N i have "index.php" that takes care to say where to find the application and system folders.
"local_config_file", it should serve to change some settings in "config/config.php" like: $config['base_url'], $config['sess_cookie_name'], etc, etc.
"local_database_file", it should serve to change some settings in "config/database.php".
Everything works, now i have to find a good way to override the configurations i need to change for each app.
In the previous link: http://caseymclaughlin.com/articles/setup-a-local-configuration-file-in-codeigniter, (which explains what I need ), it describes a way but it does not work, perhaps because dated.
Doing various tests, the only working way i've found is to add, for example, at the end of the "config/config.php"
include_once(FCPATH . 'local_config_file.php');
including the file (in this case "local_config_file.php"), that is not found in the "global_appliacation_folder/config" folder, but within the various folders app_N, that's why FCPATH in the path of inclusion.
So if i will be app_1, the included file ("local_config_file.php"), will be inside the folder app_1
I would advise to make it all separate repositories and use and dependency manager. eg. composer for php.
With that approach get better control of individual applications, with easy way how to distribute changes in the core.
This way you can also leave old apps - to depend on older version of the core fixed at a specific version
You can have
core repo
test app 1 repo
depends on core repo
test app 2 repo
depends on core repo and some other repo
test app 3 repo
depends on core repo legacy version

Yii framework installation

I am new with yii framework. I have downloaded yii-1.1.14.f0fee9.zip file, I extracted and renamed it as yii and placed to my wamp root directory. For creating sample skeleton application, first I created test_project folder in wamp root and then run folling lines to cmd prompt.
cd c:\wamp\www\yii\framework
yiic webapp ..\test_project
these lines executed in cmd prompt without error. But, could it see create any sample or skeleton files under test_project folder. I have also tried to run it with browser. It showing blank. Anybody can please help me to start a skeleton project in yii ? Iam really interesting to develop projects in yii. please help me guys.
Follow the steps
cd c:\wamp\bin\php\phpx.x.xx
c:\wamp\www\yii\framework\yiic webapp c:\wamp\www\test_project
Note that in step 1. is your php directory that has php.exe file
Update:
For detail you can have a look at this link http://www.larryullman.com/series/learning-the-yii-framework/
This is a very good tutorial for Yii application initiation.
hope this will help
I've never used wamp but as I see it has a WWW directory. You should place your projects in this directory, otherwise it won't be available for browsers. (Never take the framework files here, just leave there than you placed before)
Using yiic. It is a command line tools (doesn't work from browser) for making skeleton app, migrations etc.
try:
cd (c:....... framework) [enter]
yiic webapp c:\......\www\test_project [enter]
The main are points the WWW and the separated command
I guess it will work.
Greg

Laravel 4 - class not found on live server

I'm uploading my laravel 4 app to a testing server which is shared hosting.
I'm uploading to a password protected directory which has a .htaccess file within it. My subdomain points to the public folder.
For the most part they app is working as expected I can log in, view most of the pages however every class that I have created such as a helper class and additional controllers are not being found on the live server yet all works on my local environment.
I've redone a composer dump-autoload and uploaded the composer.json file
I'm not sure where to start with this.
In my upload I've included all the files and folders to the live server (twice now). I read somewhere else I should namespace my classes but why would this help if the main laravel controllers do not namespace?
Confused - all help appreciated
When you do a composer update, if Composer finds anything new it will update some files in the folder
vendor/composer
Like the file autoload_classmap.php.
So, you have to reupload at least this folder too.
Maybe it's about git, you are pushing changings with some certain case sensitive Folders and Files, but git is changing this therefore it will work on Mac and Windows OSs but not on the server.
just use this command:
git config core.ignorecase false
above command for the current repository and you may add --global just after config keyword.
please note that ignorecase option available since version 1.5.6 and I assume you are running 2.0.x but just mentioning!

Setting up preview of Yii2

The Yii2 preview was recently released and is available on github. I want to take it for a test drive, but the "documentation" so far gets outdated almost instantly since it is still under heavy development. I have tried to follow this guide on creating a simple CRUD app with Yii2, but it fails at the step:
php yiic.php app/create /var/www/yii2
With the error:
Could not open input file: yiic.php
Indicating that there is no file called yiic.php. The only folder within the framework folder is yii (framework/yii), and within that folder there is no file yiic.php, only Yii.php which when called in the command line gives the command list:
The following commands are available:
- asset
- cache
- help
- message
- migrate
Anyone managed to successfully setup a Yii2 app? Care to share how you got it done?
Seems like yiic has been removed for now, there are alternatives though, so read on.
It's all in the early stages, so the following method could break in the coming days/weeks/months. Therefore use with caution.
There are 2 ways to do this now:
Use composer. (I recommend this option.)
Directly copy the contents of yii2/apps/ directory to your apps directory, depending on the type of app you want to try.
There are currently 2 options for type of app - advanced, and basic. Both are in their respective directories within the yii2/apps/ directory, i.e yii2/apps/advanced and yii2/apps/basic.
For basic go through the basic readme.md, and for advanced go through the advanced readme.md.
The directions for using composer are given in the respective readme.md files. Including them here for completeness:
Basic app:
Install composer, if you don't have it.
Use composer to install the app alongwith dependencies(Yii):
php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-basic my_yii2_trial
Access app from http://localhost/my_yii2_trial/www
Advanced app:
Install composer, if you don't have it.
Use composer to install the app alongwith dependencies(Yii):
php path/to/composer.phar create-project --stability=dev yiisoft/yii2-app-advanced my_yii2_trial
According to readme, after step 2 app should be accessible, but composer was failing(see issue 439). With schmunk's tip, ran the install or install.bat command that gets copied by composer: ./install . Selected development environment (by entering choice 0 in the instructions that show up when running install command). Update: The command has been renamed to init, composer doesn't fail anymore, with fix from Qiang (check the issue 439 for more details).
Access app at: http://localhost/my_yii2_trial/frontend/www or http://localhost/my_yii2_trial/backstage/www
Here's how to copy the directory and get it working:
Basic app:
create your web-accessible directory for the app : my_yii2_trial
copy all files and folders from yii2/apps/basic/ directory to my_yii2_trial/ directory.
modify the my_yii2_trial/www/index.php file to point to the correct path for Yii.php.
For me it was within yii2/framework/yii/
comment the line that tries to include ../vendor/autoload.php file, I couldn't find that file anywhere, so its probably for some future use. it is the autoloader provided by composer.
Access from browser : http://localhost/my_yii2_trial/www
Advanced app:
create your web-accessible directory for the app : my_yii2_trial
copy all files and folders from yii2/apps/advanced/ directory to my_yii2_trial/ directory.
modify the my_yii2_trial/frontend/www/index.php file to point to the correct path for Yii.php. Similarly modify backstage/www/index.php.
comment the line that tries to include ../vendor/autoload.php file in both the index.php of backstage and frontend.
Access app at: http://localhost/my_yii2_trial/frontend/www or http://localhost/my_yii2_trial/backstage/www
Some important links to read more about this: issue 77, issue 108, issue 131, and wiki comment.
I am not sure how composer's autoloader is being used, so can't comment on that. Also in future versions, backstage might be renamed to backend.

Categories