views:

897

answers:

6

Ok, I'm about 50% done with the "30 minute" quickstart guide from Zend.

I must be missing something, because this seems like a total waste of time. The point of this quickguide is to create a guestbook, something I could do in 5 minutes with regular naked non-framework php.

Here's my path to zend framework: c:/program files/wamp/www/_zend/

Here's my path to my quickstart project: c:/program files/wamp/www/_zend/bin/quickstart/

I have a number of questions at this point:

http://framework.zend.com/docs/quickstart/create-a-model-and-database-table

1: I'm running the command line to run my database loading script. I get an error stating the it can't find the Zend/AutoLoader.php becuase my path to the zend library is wrong. I followed all of the steps. I defined the path to my zend library in the main config file, but for some reason, its defined again in my db loader. In all of these scripts that they have me load, it points the relative path to the zend library as being /../library

Problem is, there's nothing in that folder. To get to my actual zend folder, you'd need to be (relatively) /../../../../library

Which brings me to my 2nd question:

2: Where the #$#$ is the main Zend files supposed to be? The install directions were basically "put it wherever you want", when the real answer (after a bunch of errors and wasted time was) was "put it somewhere so that its really easy to type the full path a thousand times in command line" and "it also better be in a runnable place on your webserver since its going to create your quickstart application in a subdirectory within zend".

Which brings us to the third question

3: Am I supposed to have this libary in both the parent core Zend (wamp/_zend/library) AND my application (quickstart/library)?

4: If that is the case, it seems like a ton of wasted files to be uploading. I'd like to use Zend to create products that my customers will download. 5 megs of overhead seems like a bit much. Zend claims you can use these library components separately, but it looks to me like I'm going to have to upload them every time.

Which leads to the next question:

5: It appears that perhaps Zend is more for a single application that is not supposed to be distributed. Is this not the case?

6: According to their default file structure everything but my /public folder would be above public_html on my server if I wanted this to rest on my TLD. I would need to rename every reference of /public/ to /public_html/, or am I missing something else?

+1  A: 

Download zend framework, untar it in "/opt" or "/usr/lib" for example and make a link from Zend's "library" to your app's library folder. I think It's quite clear in the quickstart:

# Symlink:
% cd library; ln -s path/to/ZendFramework/library/Zend .

# Copy:
% cd library; cp -r path/to/ZendFramework/library/Zend .

If you symlink you'll have just a Zend installation for the whole server.

...Besides, make sure that Apache is reading your .htaccess.

And just point DocumentRoot to your app's public folder.

ktulur
I'm running wamp on windows vista. And I followed all of their steps.
Citizen
And I'm not sure what you mean bu that or what it would actually solve. "Point documentRoot to your apps public folder" sounds like gibberish.
Citizen
Then instead of "/opt" or "/usr/lib" use "C:\ProgramFiles". And with that sentence I main that your web document root must be the public folder in your project.
ktulur
if "Point documentRoot to your apps public folder" sounds like gibberish you should certainly not blaim Zend for you failing at getting it working... That's quite commong thing to do when setting up a framework in a secure way. Allthoug some frameworks do this for you, ZF does not because you have the choise of setting it up securely or insecurly, as with ZF you have the choise for everthing you do with it....
Nicky De Maeyer
+13  A: 

I'll try to bring some elements of answers... Hope those will help.

The point of this quickguide is to create a guestbook, something I could do in 5 minutes with regular naked non-framework php.

The point of this quickguide is to show you, quickly, in not too much time, what you need to go further by yourself.

The point is not to create a guestbook ; for such a basic application, of course, it'll always be easier/quicker to just hack a couple of script by hand, and not learn how to use a full Framework !

Zend Framework, like many "big frameworks", will be usefull when it comes to developping a real / complete application... But spending 3 months developping a full application is probably a bit too much for a "quick first look" into the framework, isn't it ? ;-)


Where the #$#$ is the main Zend files supposed to be?

Whereever suits you. Really !

For more informations, you could take a look at this chapter from the e-book Survive the Deep End : Installing The Zend Framework
(I don't think I could add much ^^ )


Am I supposed to have this libary in both the parent core Zend (wamp/_zend/library) AND my application (quickstart/library)?

No, definitly not.


Zend claims you can use these library components separately, but it looks to me like I'm going to have to upload them every time.

This is why you can install the framework in a directory outside your application :

  • no need to re-upload it each time you update your application
  • you can even use the same copy of the framework for several applications that reside on the same server !

Still, if you don't want to distribute the whole Framework with your application, you can remove components that are not usefull for your application.
It requires a bit of work, and you need to be careful (I wouldn't advise doing that, actually), but it can be done.


It appears that perhaps Zend is more for a single application that is not supposed to be distributed.

Maybe... Maybe not.

It's not necessarily what I would use for a small application (like a guestbook ^^ ).

But for a big application (say... more than 2 weeks of developments ?), I would not imagine going without a framework !
(Be it Zend Framework, symfony, or any other Framework)


According to their default file structure everything but my /public folder would be above public_html on my server if I wanted this to rest on my TLD.

That's true for any application : it is best (more secure and all that) to put what doesn't to be accessed via HTTP outside of the document root.

But you can put your library folder under the document root if needed ; that'll work too ;-)
Just put in some .htaccess file to restrict access to that directory, to be sure.


There are really an almost infinite number of ways you can do things with Zend Framework : it's all about configuration !

I admit, it takes some time to get used to it, and it's a bit hard at the beginning... But it's also one of the great things with that Framework ;-)

If you want to go a bit farther than the QuickStart, your next step might be to read Zend Framework: Surviving The Deep End : it's still work in progress and not finished... But it's an interesting read !

Pascal MARTIN
What I want to use this for is to create an application that my customers will download and install on their own servers. This doesn't seem to be built for that at all. Everything in it seems not to be portable at all. I mean, I've got to set thing in the php.ini and all that, or is that just for use during the development of the code?
Citizen
Well, at work, we are using it for applications we develop for customers, so I'd say it's OK for that ;; modifying php.ini ? If your default settings are sane, you shouldn't have much to modify ;; not portable at all ? Considering all there is you can configure, that sounds a bit odd ^^
Pascal MARTIN
What I mean is I want to create a product that is packaged that customers will purchase and download themselves, like a social networking package or a q+a script like stack overflow. It seems to me that using the zend framework would require that all of my potential customers already have zend framework installed on their machine as well.
Citizen
They need to have Zend Framework installed because they're having your app installed locally but that's not the common setup...
ktulur
@Citizen : in this case, just bundle Zend Framework with your application, and configure your application so it uses the Zend Framework copy you are providing ;; This absolutly doesn't require your clients to already have Zend Framework installed outside of your application (it's only a matter of configuration for you and your application : you have to point to the Zend Framework copy you are providing)
Pascal MARTIN
If I wanted to create something along the lines of vBulletin, is Zend even something I should use? Should I be using a different file structure? How do you handle things like the renaming of folders?
Citizen
I don't know the internals of vBulletin, so hard to tell - but I would not go without a framework (be it ZF or symfony, or whichever other framework **you know well enough**) ;; about the file structure : I would go with the one that is considered as "standard" for the framework I'm wroking with - it'll make easier for other people to understand my code ;; about the renamming of folders part, I am not sure I understand you : which folders are you talking about ?
Pascal MARTIN
I'm in general agreement with Pascal. An obvious hint, since you want package this all up for easy installation: First, stick the whole Zend library in some library directory. Then prepend that directory to your include_path via ini_set(). Now your customers don't need to worry about installing ZF, or making sure it's in their system's include_path.
timdev
re: removing not needed components - Jani Hartikainen has made us a really nice tool for that - Packagizer http://epic.codeutopia.net/pack/
robertbasic
A: 

I've found that anything with "Zend" in its name is generally a waste of both time and money, yes.

Azeem.Butt
+1, though ZDE is usable imho
roddik
If I were to be creating an exact clone of a beastly software like vbulletin, what framework should I use?
Citizen
Perhaps you should take a look at the Zend Framework - it's very high quality and might surprise you.
David Caunt
It surprised me that people paid money for it.
Azeem.Butt
ZF is totally free and open source. How could it be a waste of money?
Tim Fountain
A: 

Once you figure out how to use the framework, you will have the basic setup on hand, and it will take you five minutes to create a guestbook.

Alex L
+1  A: 

+1 for the TheDeepEnd reference. ( Installation page )

I agree with the initial learning curve. I wanted to use only aliases to point to various locations in my file system which I had decided based on some other requirements.

But while setting up Zend Framework, I tried everything I could to keep the structure unchanged, but to no avail, and finally had to change the default document root for web files to suit my file layout and Zend both. It took me a few days to get the hang of it. But now I use a simple script to alternate between httpd.conf versions with a simple restart command to change between development environments.

I think ZF is an enterprise framework and speeds things up later amazingly. Zend is a company, and as such, they ship a fully functioning framework. If you want everything easy to install, they offer Zend Server Community Edition and Zend Server / Studio commercially. They can't be expected to write "takes some learning" on the home page, can they? ;-)


Update:
The question Good Zend Framework example apps to learn from has a list of apps for studying the usage of Zend Framework.
It's very useful just to see the methods and practices commonly used.

Another great place to look for code - Google Code Search. For example, let's say you're looking for code in PHP which uses the Zend_Rest_Server class

Zend_Rest_Server lang:php
You can also use regexes and "file", "lang" operators to narrow down the results .
Just a small note: it may be a good idea to not "copy-paste" code into your program, but only use it as a help/reference to write your own code.

namespaceform
+1  A: 

Zend framework learning is not a simple walk in the park. It has a lot of strengths specially in the MVC part. I'm a newbie dev that started php with zend. It took time but It is definitely worth the time and effort.

Hanseh