zftool not behaving as expected - php

I have a hosting service in linux, where I’m trying to develop an app on zend framework 2. I want to use zftool but regardless which zftool command I run, I get always the HTML of the home page.
I’ll really appreciate any help.
Here are the steps to reproduce:
1 - I installed composer
>curl -s https://getcomposer.org/installer | php
2 - I installed the Skeleton MVC application
>php composer.phar create-project -sdev --repository-url="https://packages.zendframework.com" zendframework/skeleton-application ./hmzf
3 - Brought Composer up to date
>php composer.phar self-update
4 - Install ZFTool
>php composer.phar require zendframework/zftool:dev-master
5 - Createa symbolic link to invoke it from my project directory
>ln -s ./vendor/zendframework/zftool/zf.php zf.php
6 - Run zf.php to get the list of modules and what I get in return is the html of the home page of the skeleton app:
> php zf.php modules

I found the issue. I had to use php-cli to invoke zf.php. So instead of issuing:
php zf.php modules
which will echo the zend app home page HTML to the console, I had to issue:
php5.4-cli zf.php modules
and I've got the right response from the tool, which is:
Modules installed:
Application

Related

Testing Symfony flex on Windows

I can't make composer working with flex receipe on a symfony4 project, on Windows.
Here is the complete process :
I installed PHP7.2 from http://windows.php.net/download#php-7.2 (VC15 x86 Non Thread Safe), PATH env is set. php.ini is created (from php.ini-development). PHP is working on windows (php -v).
I installed composer from the Composer-Setup.exe (https://getcomposer.org/download/). It changed the php.ini for me for activating some php extensions (openssl, etc).
I created a project with composer create-project symfony/skeleton sf4
I moved to sf4 dir : cd C:/sf4
I run Web Server : php -S 127.0.0.1:8000 -t public
It works when I browse locahost:8000
So I want to install the symfony twig bundle as a flex package : composer require twig
The error I get :
[InvalidArgumentException]
Could not find package twig.
Did you mean one of these?
twig/twig
slim/twig-view
latte/latte
twig/extensions
timber/timber
I tried with a local composer.phar inside the sf4 project :
cd C:/sf4
php composer.phar require twig
=> same error
Composer seems to ignore flex plugin, do you have any idea ? Thx !
see the answer of nicolas-grekas in the following link
you can continue using the symfony containers in this link, just look for the alias that flex used.
in your case twig for flex is "symfony / twig-bundle", run composer req symfony / twig-bundle.
salu2

create new web application in yii 2 advanced

I just started to try yii php framework, i have followed all the installation tutorial and I can run the yii framework, but i got stuck when I wanted to create a new web application by using command prompt.
the following command is like
cd c:\xampp\pathtoyii\framework
then
yiic webapp newWebAPP
the problem is in my yii folder doesn't contain framework folder and yiic file that i must write in the following command. anyone know this issue?
here is my yii folder root
no framework folder there.
actually, I need a path like this
and this is the framework folder.
is there any different in new version of yii that I installed?
So the issue here is you are mixing Yii1 and Yii2. If the tutorial you are reading references "yiic", that is Yii1, not Yii2. The framework folder you show also is from Yii1.
I'm not sure if you are trying to write a Yii1 or Yii2 app. If Yii2, check out the instructions for setting up a new app here: http://www.yiiframework.com/doc-2.0/guide-start-installation.html If Yii1, here: http://www.yiiframework.com/doc/guide/1.1/en/quickstart.installation
They are very similar, but are fundamentally different frameworks as Yii2 is NOT backwards compatible.
Read the installation guide!
First, you must install a composer.
Than, require asset plugin:
composer global require "fxp/composer-asset-plugin:~1.1.1"
and install project:
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
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

Composer install cant find composer.json

I am trying to just install composer, I am on mac osx. I have done it before using the terminal lines from their site and it worked just fine. I got a clean install on my mac now, and it won't install properly.
I tried to:
cd ~
curl -sS https://getcomposer.org/installer | php
and and:
cd /Applciations/MAMP/htdocs
curl -sS https://getcomposer.org/installer | php
and neither works. (I saw a post saying I should cd to a directory before trying to install it. But no matter what, I keep hitting this error:
Composer could not find a composer.json file in /Applications/MAMP/htdocs
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
when trying to install composer.
I think your question arises from a slight misunderstanding. Composer installs itself when you run the script provided on their Web site. No additional work to install Composer is necessary.
$ php composer.phar install is used to install packages with Composer, which are almost always listed in a JSON file named composer.json. Without this file, Composer doesn't know which packages to install and fails.
See "Declaring Dependencies" in Composer's Getting Started guide for how to generate a composer.json for your project.
In my case, I had a deprecated error being output from PHP. Apparently that causes composer to fail detecting the composer.json file.

Installing Yii 2 demo application

i am trying to install yii 2 and to run the basic or advanced application.
i have tried the steps given here Setting up preview of Yii2 to do this.
the steps i followed,
1 - Installed the composer
2 - 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
3 - Access app from http://localhost/my_yii2_trial/web
The problem is, i am getting this syntax error.
Parse error: syntax error, unexpected '[', expecting ')' in D:\xampp\htdocs\my_yii2_trial\vendor\yiisoft\yii2\yii\Yii.php on line 25
can any body help to resolver this issue pls
Yii2 has started using PHP 5.4's Short array syntax. Your error creeps up because of:
spl_autoload_register(['Yii', 'autoload'], true, true);
in Yii.php, which is the new short array syntax. As you have already figured out, you need to install PHP 5.4 now to run Yii2 apps.
The commit which made the changes to short array syntax.
The docs and composer details that have been changed.
The discussion where the decision to move to PHP 5.4 was made.
As Yii2 is still in heavy development, its requirements are also changing. So be sure to read the readme thoroughly before installing.
See also the Backward Incompatible changes list for PHP 5.4, to make changes to your existing code.
Install PHP 5.4 to resolve this issue.
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
Here is command lines to install yii2 on ubuntu:
cd /var/www
/var/www$ ls
/var/www$ cd myyii2
/var/www/myyii2$ ls
/var/www/myyii2$ ls -al
/var/www/myyii2$ ls
/var/www/myyii2$ php init
/* Your choice [0-1, or "q" to quit] 0*/
choose 0 for developemnt and type yes
php yii migrate (/var/www/myyii2$ php yii migrate)
Before this command need to download advance setup like [yii-advanced-app-2.0.7.tgz]

zf.php: command not found ubuntu 12 Zendframework

I have downloaded and extracted the ZendSkeletonApplication as said in the
http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html
Now when the try installing the zftool by follwing the document
1.http://framework.zend.com/manual/2.1/en/modules/zendtool.introduction.html
when typed
composer require zendframework/zftool:dev-master
i got Error:
No command 'composer' found, did you mean:
Command 'compose' from package 'mime-support' (main)
composer: command not found
So tried Manual installation
Extracted and placed as said in manual
i have installed the ZFTool here:
/var/www/ZendSkeletonApplication/vendor/ZFTool
This also says Error:
zf.php: command not found
Not sure what else is creating problem.
Can you guys, please provide with a step by step way of installing zftool
Place yourself in the root of the project
On Linux run command find -name zf.php just to find the location of the file under your project.
If you find it - mine was under vendor/bin, run the following command:
php vendor/bin/zf.php create module Test
This command will create the Test Module.

Categories