I'm new to Yii2, now I'm trying to install yii2 application advanced template.
I did follow these steps:
1 - Download yii2-app-advanced zip file from https://github.com/yiisoft/yii2-app-advanced
2 - Follow GETTING STARTED guide:
+ I'm using Uniform Zero Server (installed in F disk with the path "F:\Server\UniServerZ\www") ok.
+ I creted new folder with name "yii2" in the "www" directory ("F:\Server\UniServerZ\www\yii2")
+ I extracted zip file yii2-app-advanced into "yii2" folder (Every source of yii2-app-advanced now in "yii2" folder so it is the root directory of yii2-app-advanced)
+ Click init.bat file to run "init" and select (0 - Developer mode) and type "yes" to confirm. Done
+ And then I click the yii.bat file, but nothing happened.
+ I tried use this url : localhost/yii2/backend/web/
And I get this Error:
Fatal error: require(): Failed opening required 'F:\Server\UniServerZ\www\yii2\backend\web/../../vendor/autoload.php' (include_path='.;F:/Server/UniServerZ/home/us_pear/PEAR') in F:\Server\UniServerZ\www\yii2\backend\web\index.php on line 5
or url : localhost/yii2/frontend/web/
And I get this Error too:
Fatal error: require(): Failed opening required 'F:\Server\UniServerZ\www\yii2\frontend\web/../../vendor/autoload.php' (include_path='.;F:/Server/UniServerZ/home/us_pear/PEAR') in F:\Server\UniServerZ\www\yii2\frontend\web\index.php on line 5
I checked the "vendor" directory follow this path:
F:\Server\UniServerZ\www\yii2\vendor
But it's empty.
So what should I do to fix this error and install yii2 application advanced template?
(My Uniform Server runs PHP5.4)
Yii2 Installation Following command:
(1) First install Composer (LINUX):
Locally:
curl -sS https://getcomposer.org/installer | php
OR
(1) First install Composer (WINDOWS):
C:\Users\username>cd C:\bin
C:\bin>php -r "readfile('https://getcomposer.org/installer');" | php
Note: If the above fails due to readfile, use the http url or enable php_openssl.dll in php.ini
C:\bin>echo #php "%~dp0composer.phar" %*>composer.bat
C:\Users\username>composer -V
Composer version 27d8904
(2) Yii2 framework online downloads:
Basic App:
php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.0-beta
Advanced App:
php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.0-beta
(3) Other App Settings Command:
php init
php yii migrate
If you are working on linux, go to the downloaded project and in the terminal type (if you have a composer):
php composer.phar install
If the composer is not installed go to https://getcomposer.org/download/ After this, yii2 framework and other extensions will be installed at vendor directory. This should fix the problem
Install with composer :
D:\wamp\www> composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced D:\wamp\www\myyii2app
and run php ./init
D:\wamp\www\myyii2app>php ./init
Under Linux, cd to the directory of the downloadable project using Terminal and run the following commands:
$ php init --env=Development
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar update
Installing using Composer
If you do not have Composer, follow the instructions in the Installing Yii section of the definitive guide to install it.
With Composer installed, you can then install the application using the following commands:
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
The first command installs the composer asset plugin which allows managing bower and npm package dependencies through Composer. You only need to run this command once for all. The second command installs the advanced application in a directory named yii-application. You can choose a different directory name if you want.
Install from an Archive File
Extract the archive file downloaded from yiiframework.com to a directory named advanced that is directly under the Web root.
Then follow the instructions given in the next subsection.
Preparing application
After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.
Execute the init command and select dev as environment.
php /path/to/yii-application/init
Otherwise, in production execute init in non-interactive mode.
php /path/to/yii-application/init --env=Production --overwrite=All
Create a new database and adjust the components['db'] configuration in common/config/main-local.php accordingly.
Apply migrations with console command yii migrate.
A php component might be missing, i installed mbstring, then restarted the whole process.
yum -y install php54w_mbstring
composer init
composer create-project --prefer-dist
--stability=dev yiisoft/yii2-app-basic <project-name>
****To install YII2-Advance use these command at your CMD. And see bellow...........****
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Users\admin>e: (RUN COMMAND)
E:>cd xampp/htdocs (RUN COMMAND)
E:\xampp\htdocs>composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application (RUN COMMAND)
Installing yiisoft/yii2-app-advanced (2.0.9)
- Installing yiisoft/yii2-app-advanced (2.0.9)
Loading from cache
Created project in yii-application
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing yiisoft/yii2-composer (2.0.4)
Downloading: 100%
Installing swiftmailer/swiftmailer (v5.4.3)
Downloading: 100%
Installing bower-asset/jquery (2.2.4)
Downloading: 100%
Installing bower-asset/yii2-pjax (v2.0.6)
Downloading: 100%enter code here
Installing bower-asset/punycode (v1.3.2)
Downloading: 100%
Installing bower-asset/jquery.inputmask (3.2.7)
Downloading: 100%
Installing cebe/markdown (1.1.0)
Downloading: 100%
Installing ezyang/htmlpurifier (v4.8.0)
Downloading: 100%
Installing yiisoft/yii2 (2.0.9)
Downloading: 100%
Installing yiisoft/yii2-swiftmailer (2.0.5)
Downloading: 100%
Installing yiisoft/yii2-codeception (2.0.5)
Downloading: 100%
Installing bower-asset/bootstrap (v3.3.7)
Downloading: 100%
Installing yiisoft/yii2-bootstrap (2.0.6)
Downloading: 100%
Installing yiisoft/yii2-debug (2.0.6)
Downloading: 100%
Installing bower-asset/typeahead.js (v0.11.1)
Downloading: 100%
Installing phpspec/php-diff (v1.1.0)
Downloading: 100%
Installing yiisoft/yii2-gii (2.0.5)
Downloading: 100%
Installing fzaninotto/faker (v1.6.0)
Downloading: 100%
Installing yiisoft/yii2-faker (2.0.3)
Downloading: 100%
Writing lock file
Generating autoload files
E:\xampp\htdocs>cd yii-application (RUN COMMAND)
E:\xampp\htdocs\yii-application>php init (RUN COMMAND)
Yii Application Initialization Tool v1.0
Which environment do you want the application to be initialized in?
[0] Development
[1] Production
Your choice [0-1, or "q" to quit] 0 (Enter with 0 RUN COMMAND)
Initialize the application under 'Development' environment? [yes|no] yes (Enter with yes RUN COMMOND)
Start initialization ...
... initialization completed.
E:\xampp\htdocs\yii-application>yii migrate (RUN COMMOND)
Yii Migration Tool (based on Yii v2.0.9)
Creating migration history table "migration"...Done.
Total 1 new migration to be applied:
m130524_201442_init
Apply the above migration? (yes|no) [no]:yes
*** applying m130524_201442_init
create table {{%user}} ... done (time: 0.225s)
*** applied m130524_201442_init (time: 0.310s)
1 migration was applied.
Migrated up successfully.
Finally created yii-application folder in htdocs
E:\xampp\htdocs\yii-application>
If you want to install Yii2 advanced template go to http://www.yiiframework.com/download/ and download the Yii 2 with advanced application template. Once you have extracted the archive file in the www folder.
Then Go to Terminal(For Ubuntu) or cmd(Windows user)
For Ubuntu-
provide root to the extracted folder(advanced) in the Terminal
cd var/www/html/ashish/advanced
Now give the commond- php init
Now advance template is installed properly
Related
I'm trying to deploy a PHP app to Heroku but I don't think my dependencies are installing properly.
When I run git push heroku master I see these lines:
Installing dependencies...
Composer version 1.2.4 2016-12-06 22:00:51
Loading composer repositories with package information
Installing dependencies from lock file
-Installing components/jquery (3.1.1)
Downloading: 100%
-Installing fortawesome/font-awesome (v4.7.0)
Downloading: 100%
-Installing phpmailer/phpmailer (v5.2.22)
Downloading: 100%
No errors or anything. But when I open the heroku app after it's been deployed I have all kinds of console errors for jquery not being found.
I looked in developer tools in the sources tab and see a folder named vendor/fortawesome/font-awesome/css (that's the actual whole folder name) with the file font-awesome.min.css in it ... but shouldn't they all be installed in a vendor folder?
Not sure what I'm doing wrong.
When I install Zend via composer create-project -n -sdev zendframework/skeleton-application as specified by Zend's main tutorial, I get a skeleton application that seems to work nicely.
However, when I follow this tutorial's advice to use composer development-enable, I get the following message:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "development-enable" is not defined.
Is anyone able to duplicate/fix this problem?
I would normally assume it's an issue with the bash $PATH value, but the composer command by itself runs just fine, so I'm thinking it may be some other problem specific to this subcommand -- a missing dependency somewhere, for example.
Here is the relevant piece of the tutorial I am trying to follow:
https://docs.zendframework.com/tutorials/getting-started/skeleton-application/
(In case it helps for purposes of duplication: The CLI PHP version on my development server is 5.4.43. For reasons I won't bore you with, I can't update this CLI PHP to a newer version; the major release that Apache is using on my machine is 5.6.)
EDIT 1: Rerunning my installation using composer create-project -s dev zendframework/skeleton-application (as specified in the linked tutorial) still results in the same problem.
EDIT 2: Here is my shell input/output.
patrick [~/www/berlin-data]# composer create-project -n -sdev zendframework/skeleton-application
Installing zendframework/skeleton-application (2.3.3)
- Installing zendframework/skeleton-application (2.3.3)
Loading from cache
Created project in /home1/patrick/public_html/berlin-data/skeleton-application
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing zendframework/zendxml (1.0.2)
Loading from cache
- Installing zendframework/zendframework (2.3.3)
Loading from cache
zendframework/zendframework suggests installing doctrine/annotations (Doctrine Annotations >=1.0 for annotation features)
zendframework/zendframework suggests installing ircmaxell/random-lib (Fallback random byte generator for Zend\Math\Rand if OpenSSL/Mcrypt extensions are unavailable)
zendframework/zendframework suggests installing ocramius/proxy-manager (ProxyManager 0.5.* to handle lazy initialization of services)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf for creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recaptcha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\Form)
Writing lock file
Generating autoload files
patrick [~/www/berlin-data]# cd skeleton-application/
patrick [~/www/berlin-data/skeleton-application]# composer development-enable
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "development-enable" is not defined.
When you run the command
composer create-project -n -sdev zendframework/skeleton-application
This will create a directory in your current dir called skeleton-application inside of this directory is where you need to run the command:
composer development-enable
If this still doesnt work then something went wrong with install process.
The first command should give out put something like:
$ composer create-project -n -sdev zendframework/skeleton-application
Installing zendframework/skeleton-application (dev-master 941da45b407e4f09e264f0 00fb537928badb96ed)
- Installing zendframework/skeleton-application (dev-master master)
Cloning master from cache
Created project in C:\Users\<UserName>\Documents\skeleton-application
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing zendframework/zend-component-installer (0.3.0)
Downloading: 100%
- Installing zendframework/zend-stdlib (3.0.1)
Downloading: 100%
...
Notice this line Created project in C:\Users\<UserName>\Documents\skeleton-application
Thats the directory you need to be in to run the command:
cd C:\Users\<UserName>\Documents\skeleton-application
composer development-enable
If that still didnt work, try specifying the version for downloading:
composer create-project -n "zendframework/skeleton-application":"dev-master"
PS
As of writing this the skeleton application requires PHP "^5.6 || ^7.0". So if you are running a lower version composer wont install that copy. And the tutorials based on it may not work as expected.
Two things I've noticed: when you first initialize a skeleton application, depending on your settings, development mode is enabled by default.
If you want to run
composer development-enable
or any other similar commands, you must be in your path/to/install or path/to/yourapp directory for it to work! This is the folder that contains your local composer install. If you are in any of the parent directories, the command will not work.
I was also having this similar problem when trying to enable development mode with the command composer development-enable on my apigility app. I was getting error:
zf-development-mode is not recognised as an internal or external command.
There is a page on the apigility website regarding the development mode module:
https://apigility.org/documentation/modules/zf-development-mode
I found by following the instruction to install the module from composer:
$ composer require zfcampus/zf-development-mode
Then making a copy of the development config file:
$ cp vendor/zfcampus/zf-development-mode/development.config.php.dist config/
Now using the composer development-enable seems to work fine, which in my case returned the message 'Already in development mode'.
I have Composer installed globally, So I open CMD and write the following command to create a project (composer create-project --prefer-dist cakephp/app my_app_name). What this does is install the project in my user folder. I need the project to be installed in wamp/www folder. And I can't for the life of me figure out how to set the path. Should I just cut-paste the project there or will that create issues with cakephp? still new to the framework :)
Any help would be appreciated. Thanks.
Installing CakePHP
Before starting you should make sure that you have got an up to date PHP version:
php -v
You should at least have got installed PHP 5.5.9 (CLI) or higher. Your webserver’s PHP version must also be of 5.5.9 or higher, and should best be the same version your command line interface (CLI) PHP version is of.
Installing Composer
CakePHP uses Composer, a dependency management tool, as the officially supported method for installation.
Installing Composer on Linux and Mac OS X
Run the installer script as described in the official Composer documentation and follow the instructions to install Composer.
Execute the following command to move the composer.phar to a directory that is in your path:
mv composer.phar /usr/local/bin/composer
Installing Composer on Windows
For Windows systems, you can download Composer’s Windows installer here. Further instructions for Composer’s Windows installer can be found within the README here.
Create a CakePHP Project
Now that you’ve downloaded and installed Composer, let’s say you want to create a new CakePHP application into my_app_name folder. For this just run the following composer command:
php composer.phar create-project --prefer-dist cakephp/app my_app_name
Or if Composer is installed globally:
composer self-update && composer create-project --prefer-dist cakephp/app my_app_name
Once Composer finishes downloading the application skeleton and the core CakePHP library, you should have a functioning CakePHP application installed via Composer. Be sure to keep the composer.json and composer.lock files with the rest of your source code.
First point your composer to www folder.In my case i am using Xamp so pointed my composer to htdocs
C:\xampp\htdocs>composer create-project --prefer-dist cakephp/app my_app_name
Installing cakephp/app (3.3.2)
- Installing cakephp/app (3.3.2)
Downloading: 100%
Created project in my_app_name
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Updated
I am using windows .
C:\Users\Vision>cd\
C:\>cd xampp
C:\xampp>cd htdocs
C:\xampp\htdocs>
Also in windows if i right click on inside htdocs any folder i have option to use composer here
I have a fresh install of Symfony with everthing looking in-place apart from my vendors directory is empty? That is, it has
composer and doctrine directories in it but they are empty. If I stand in my root and run the command:
$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing doctrine/lexer (v1.0.1)
Downloading: 100%
Failed to download doctrine/lexer from dist: Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php5/php.ini
Now trying to download from source
- Installing doctrine/lexer (v1.0.1)
Cloning 83893c552fd2045dd78aef794c31e694c37c0b8c
[RuntimeException]
Failed to clone git#github.com:doctrine/lexer.git via git, https, ssh protocols, aborting.
- git://github.com/doctrine/lexer.git
Cloning into '/cygdrive/c/Apache24/htdocs/symfony.local/vendor/doctrine/lexer'...
fatal: remote composer already exists.
- https://github.com/doctrine/lexer.git
fatal: destination path '/cygdrive/c/Apache24/htdocs/symfony.local/vendor/doctrine/lexer' already exists and is not an empty directory.
- git#github.com:doctrine/lexer.git
fatal: destination path '/cygdrive/c/Apache24/htdocs/symfony.local/vendor/doctrine/lexer' already exists and is not an empty directory.
At the front end browsing to http://symfony.local/web/
Warning: require(C:\Apache24\htdocs\symfony.local\app/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\symfony.local\app\autoload.php on line 11
Fatal error: require(): Failed opening required 'C:\Apache24\htdocs\symfony.local\app/../vendor/autoload.php' (include_path='.;c:\php\includes') in C:\Apache24\htdocs\symfony.local\app\autoload.php on line 11
Clearly it's looking for /vendor/autoload.php but this isn't there. Why is my vendor directory empty and how can I ensure the libraries get installed?
$ composer update returns:
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing paragonie/random_compat (1.1.4)
Downloading: 100%
Failed to download paragonie/random_compat from dist: Could not decompress the archive, enable the PHP zip extension.
The php.ini used by your command-line PHP is: /etc/php5/php.ini
Now trying to download from source
- Installing paragonie/random_compat (1.1.4)
Cloning d762ee5b099a29044603cd4649851e81aa66cb47
[RuntimeException]
Failed to clone git#github.com:paragonie/random_compat.git via git, https, ssh protocols, aborting.
- git://github.com/paragonie/random_compat.git
Cloning into '/cygdrive/c/Apache24/htdocs/symfony.local/vendor/paragonie/random_compat'...
fatal: remote composer already exists.
- https://github.com/paragonie/random_compat.git
fatal: destination path '/cygdrive/c/Apache24/htdocs/symfony.local/vendor/paragonie/random_compat' already exists and is not an empty directory.
- git#github.com:paragonie/random_compat.git
fatal: destination path '/cygdrive/c/Apache24/htdocs/symfony.local/vendor/paragonie/random_compat' already exists and is not an empty directory.
Well, your PHP is not properly configured.
Adjust your /etc/php5/php.ini and enable the "ZIP" extension.
And the rest is probably a permissions issue, because you are using Cygwin in combination with Composer. Composer and Cygwin are not really best friends.
My suggestion: run Composer on the native Windows CLI, just for the vendor fetching part.
What you want is composer update. It will read your composer.json to install all required packages. composer install is used for deployment.
Download and enable the zip extention for PHP
If you are using PHP7.0 and use a debian base distribution (Ex: Ubuntu), use the following to install and enable it automaticaly
apt-get install php-zip
I am trying to install Symfony2 via composer on an Ubuntu server:
php composer.phar create-project symfony/framework-standard-edition /var/www/dev/myproject 2.1.7
but it fails with the following error:
- Installing doctrine/doctrine-bundle (v1.1.0)
Downloading: 100%
rm: cannot remove `/var/www/dev/myproject/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle': Directory not empty
[ErrorException]
ZipArchive::extractTo(): File name too long
Google didn't help, any idea what the problem could be?
Thanks!
try by going inside the directory where you want to install it and then execute
php composer.phar create-project symfony/framework-standard-edition myproject 2.1.7
I guess the problem had to do with the linux server being a VM and the folder I tried to install symfony2 in was a folder shared from windows (the host) ...
After rebooting that error went away (leaving me with lots of random composer errors, but those are not in the scope of this question ;))