Zend Framework Tool - zf.php: command not found - php

I'm trying to install Zend Framework Tool.
I follow the documentation and when I run zf.php modules (as stated in the docs) I get zf.php: command not found
I found someone who was having a similar problem here - Could not open input file: zf.php
..so from that post I tried the alternative (from my project directory - /var/www/zf-tutorial) vendor/bin/zf.php modules and it successfully lists my modules.
Why is this inconstant with the documentation? Do I have to write out this whole path every time?
==
So next, when trying to CREATE a project using Zend Tool, naturally I feel I need to navigate out of the project directory to my all projects directory (/var/www)
So I try zf2-tutorial/vendor/bin/zf.php create project zendtest from there... and I get the error (seems strange anyway that I might run a script of another project to create a new one but I'm just trying figure things out for now):
Error: I cannot find the autoloader of the application.
Check if /var/www contains a valid ZF2 application.
OK, seems I need to be within my projects directory where I installed it? So, grudgingly I go back into my projects directory (/var/www/zf2-tutorial) and run it from there - which seems even stranger that I should create a project from within another project... but it seems to work, .. but no, as it puts it inside my zf2-tutorial directory as that is where I am (thought it might)
How do I use this tool? Ideally I'd like to install it once and have it available for ALL projects current and future. Is simply zf create projects too possible? zf.php ... just seems messy

Related

How to prevent FrameworkBundle assets being copied with `console assets:install` in Symfony3?

I am new to Symfony, creating my first project with Symfony3.
I wanted to make as much as possible "in the line" with mainstream instructions.
The problem I am trying to solve now is related with console assets:install CLI command: I do not want this command to copy vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/public/* files to web/bundles/framework directory (they're just some misc files, such as Symfony logo).
I have looked for some sort of "exclusion" mechanism for AssetsHelper, but found nothing. I am aware that deleting FameworkBundle is not the way to go.
This might be also related with Symfony2.

How do I run/use the Yii command line tool ?

What EXACTLY do I do to run the "Yiic Command line tool"
Open my reg CMD? double click on a certain file?
In the screen cast the tut tells you were going to need to use the Yii command line tool and then the screen instantly cuts to a command line that has some yii related text
My spidey sense is telling me that the answer to this question is going to probably be incredibly obvious and simple , but ive done a decent amount of searching and even if I figure it out I still think this question should be in the books because I know I cant be the only one whos never used a command line tool/was confused about this.
Only started using windows again recently but there should be a yiic.bat located in the framework directory of wherever you extracted yii. You will need to either append this location to your PATH variable or cd into the directory when you want to run yiic. You will also need php installed.
Hope this helps
Some links:
http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app
http://www.php.net/manual/en/install.windows.installer.msi.php
http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx
Have just had a quick go myself and seems to work, steps were:
downloaded & installed wamp http://sourceforge.net/projects/wampserver/
watched this vid http://www.youtube.com/watch?v=Rra_UKJRagA
downloaded yii http://www.yiiframework.com/download/
created a frameworks dir in wamp root as in vid and extracted yii to it
edited the yiic.bat to point to the php executable in wamp
opened CMD cd'd to the dir containing yiic.bat and typed "yiic webapp foo"
pressed return and got 'correct response from CMD'
shame the video doesn't have sound but thanks xibian for sharing :-)
If you dont like command-line tools, you can use Gii
http://www.yiiframework.com/doc/guide/1.1/en/topics.gii
Starting from version 1.1.2, Yii is equipped with a Web-based code generation tool called Gii. It supercedes the previous yiic shell generation tool which runs on command line. In this section, we will describe how to use Gii and how to extend Gii to increase our development productivity.

Cannot create a zend framework project from the command line

I have done all the configurations required to run a zend framework project on the server,and its working fine.But when I try to create a new project from the command line,
C:\wamp\www> zf create project myproject
its not creating the project.Also its not giving any error.I have set the paths of php.exe and zf.bat.
C:\wamp\www> zf show version is also not doing anything.
There is not much information about this in the online documentation.
It could be something related to permission, depending on where the zf.bat is, I have experienced some issues when trying to call bat or similar files that are under certain C:/ folders. If that's not the problem, and you are not receiving any error messages in prompt when calling zf tool, check your Event Viewer, you can probably get more info about the error there.

PHP Command Line running, zend framework set up problem

Im trying to learn how to set up a Zend framework web application from scratch. Ive been using Magento and I understand how powerful Zend is, but im over my head it seems like.
So I bought a book, developing web applications with Zend 1.8 by Keith Pope, and I cant even follow past the first chapter. The thing that is confusing the hell out of me is the whole command line deal.
Here is a passage from the book --
Once we have downloaded the Zend Framework release package, we need to do some basic installation before we can start creating our application. First, create a new directory within your web server's document root, from which the application will be served. The examples in this chapter use the directory name of helloZend. Next, copy the library and bin directories from the release package into the newly created directory. The library directory contains all of the Zend Frameworks
source files, and the bin directory contains the command line interface for the
Zend Framework. The Zend Framework is now installed and ready for use!
Creating the project structure
We are now ready to start creating the directory structure for our project. In order to do this, we are going to use the command line interface provided by the Zend Framework. This interface uses the Zend_Tool component that provides a whole host of commands that makes it very easy to get up and running with the Zend Framework in just a few minutes.
In order to create the project structure, open up your command line and change into the hellozend directory, and then run the following command:
For Windows users:
bin\zf.bat create project
For Linux and Mac users:
bin/zf.sh create project
Ok so Ive done all that. But up above in first part he says upload it to your web server, did that already. But then "open up your command line", how exactly do I do this? The only command line I understand I can access is Terminal, do I do something with Terminal or??? (Im on a mac) - I tried navigating straight to bin/zf.sh on my webserver and it brought up a what do you want to open this link with, I chose terminal and nothing happened.
Can someone clarify this for me? I realize this may be a stupid question, but I have zero experience working with non live servers and what not....
I've been a ZF developer for several years, but was working on a pre- 1.5 version up until very recently (not by choice) I found it easiest to build a local version on my machine via ZendServer CE, then once all was running and stable, port it over to my dev server. Because I have full root permissions locally, I didn't run into any issues of naming/permissions as I walked through the initial tutorial of new features and initial setup.
Also, don't miss Akrabat's tutorial on getting started the ZF. It's very well written and in some cases easier to understand than the quickstart: http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf
I don't say this to developers often, but you are in over your head if you don't yet understand how to open and use a command-line shell. Your question is not stupid -- everyone has to get started somewhere. But Stack Overflow is a place for specific questions about programming, like "I tried X and it didn't do what I expected, how should I code it instead?"
All I can suggest to you is to start studying. I believe that it's counter-productive to try learning new tools at the same time as trying to get a project done. So spend some time just learning the Terminal interface and how to run things in that environment.
Google for "Mac Terminal tutorial" and a bunch of useful articles and YouTube videos come up. Start there.
I also recommend "Mac OS X: The Missing Manual".
Re your comment: Okay, I think I'm seeing the source of your confusion. What the excerpt is not saying is that you need to open a shell on the host where you're developing your ZF app. What I do is to develop the project on my local host (my Macbook) so I can have quick access for moving files around and so on. This means I run an instance of Apache running on my Mac.
Then at intervals, when the app is running and done with respect to a given milestone of functionality, I upload the whole set of files I developed to my production server.
Tell me if I'm getting warmer. I really can't tell what you know and what you don't know because of the way you've asked your question.
anyone who needs the basic understanding of connecting to a webserver via terminal or command line via ssh should read the following:
http://www.elated.com/articles/ssh-and-basic-commands/
Although, the information there didn't work with my particular webhost. I had to format the connect command like this:
ssh user#host -p 1234
Where 1234 is the servers port number, which you will need to get from your webhost if you dont know it.
To run that script, navigate to directory where you've uploaded it (you open terminal, connect to your server via ssh if you're doing this remotely).
After that execute it like this:
./zf create project your_project_name
It should create new dir named "your_project_name" and in it many other sub-directories for your application.
Also, I'd recommend that you go for http://framework.zend.com/manual/en/learning.quickstart.html instead that book - Quick Start really is great.

Can projects using PHP framework operate standalone?

I am interested in the PHP framework, especially by symfony and ZendFramework, but I am not sure of one thing: I saw the need to type command lines to create a project with these frameworks. Ok, but once the project is finished, is it possible to move files to another server without installing anything (except for Apache)?
Thank you in advance
Ps: No report, but do StackOverflow uses a framework?
It is absolutely possible to run a symfony or zend framework application without installing the framework on the server. Symfony has a special mechanism to pack everything into one folder. If you use zend framework you basically have to copy the "Zend" folder to your "lib" directory and you are ready to go.
As far as I know, StackOverflow is build on ASP.net and C# running on several windows servers.
Firstof, most of those commands are needed for development only. But also you do not have to have the commands in your global path, it's also possible to execute the scripts directly.
In case of symfony that would be something like
./symfony-framework/data/bin/symfony
if you installed symfony to symfony-framework.
I believe stackoverflow is based on .NET MVC or plain ASP .NET - http://meta.stackoverflow.com will give you that answer
With Zend Framework, it is possible. The Zend_Tool part, which sets up the basics of your project is just addition. You can, but you don't have to use it at all. You can just write the project from scratch yourself, just stick to the standard project architecture.
Anyway, once the project is ready, it does not need any command line setup, other than mayby setting correct file system permission if your project needs to write some files.
I can't say about symphony, but I assume it also can be just copied to the target server.
I don't know, how about ZF, but project made with Symfony can be easily moved to another server just by copying files. However it will be difficult to maintain your project without commands. Also you have to copy all Symfony's core files to your server, but it will be better to install Symfony there before.
About Symfony:
Usually, you develop locally on your dev environment (using Wampserver or MAMP for example). You will require access to the command line to run symfony commands, specially for complex tasks like ORM tasks. So you have to install symfony on that environment.
According to the official doc the recommended installation method is through SVN (either the trunk or a tag) inside your project folder.
When you'll push the files from your dev environment to another (using project:deploy if you can), all the required files will be pushed.
So there is no need to install (in the sense of "run" or "execute") anything on the live environment server. The only "installation" method that requires an access to the command line is the PEAR install method, which is not recommended.
The only problem that I had when I deployed an application was a user permission problem on the cache folder, but that's easy to fix by changing the folder permission.

Categories