Author Topic: [SOLVED] Zend Framework and WAMP  (Read 21254 times)

0 Members and 1 Guest are viewing this topic.

Offline ma2ttTopic starter

  • Irregular
  • Posts: 4
    • View Profile
[SOLVED] Zend Framework and WAMP
« on: November 28, 2008, 10:27:26 AM »
I'm trying to install Zend Framework on my laptop to familiarise myself with it. I already have WAMP installed with a dozen or so website projects sitting in the WAMP server root (c:\wamp\www).

The installation instructions that I have followed so far include a .htaccess file to reroute everything to index.php. Am I right in thinking that Zend Framework effectively takes over the whole server?

I still need access to the existing projects already in the WAMP server root without using ZF. How do I achieve that? Does ZF require its own dedicated server?

I'm kinda new to this (if you didn't already guess! haha)

Thanks
Matt

Offline Mchl

  • Staff Alumni
  • Freak!
  • *
  • Posts: 8,582
  • Gender: Male
  • That's Largo in my avatar, not me.
    • View Profile
    • FlingBits
Re: Zend Framework and WAMP
« Reply #1 on: November 28, 2008, 10:33:58 AM »
Put the .htaccess in ZF folder not in the root, and change the paths in it accordingly.

Since it's for tests only, I put my public and application folders both in c:\wamp\www\zf\
NetBeans fanatic | ExtJS masochist | C++ denier
PHP4 & MySQL4 are no longer supported.
PHPFreaks Tutorials | PHP Debugging: A Beginner's guide | PHP Security Tutorial || How To Ask Questions The Smart Way
Flingbits tutorials | Class Autoloading

Offline ma2ttTopic starter

  • Irregular
  • Posts: 4
    • View Profile
Re: Zend Framework and WAMP
« Reply #2 on: November 28, 2008, 10:39:31 AM »
Nice one! I'll try that.

Many thanks Mchl  :)

Offline Xeoncross

  • Enthusiast
  • Posts: 253
  • Gender: Male
  • not enough minerals
    • View Profile
    • Code 2 Design
Re: Zend Framework and WAMP
« Reply #3 on: November 29, 2008, 01:55:59 PM »
The installation instructions that I have followed so far include a .htaccess file to reroute everything to index.php. Am I right in thinking that Zend Framework effectively takes over the whole server?

Nope, ZEND doesn't take over anything. The .htaccess that you place in a folder does affect all sub-folders though.

Quote
I still need access to the existing projects already in the WAMP server root without using ZF. How do I achieve that? Does ZF require its own dedicated server?

I have my XAMMP and WAMP servers setup with sub directories.

Code: [Select]
C:/wamp/www/
C:/wamp/www/zend/
C:/wamp/www/project1/
C:/wamp/www/project2/

The answer is to use RewriteBase in your rewrite rules. See this topic:
http://codeigniter.com/forums/viewthread/85429/

Also, if you want to install Xdebug for testing I made a video about it here.
« Last Edit: November 29, 2008, 01:57:13 PM by Xeoncross »

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend Framework and WAMP
« Reply #4 on: November 29, 2008, 05:44:02 PM »
It just has to be present in the include_path. That's basically how you "install" it.

For each project I prefer to give it it's own hostname and it's own VirtualHost in Apache. I just edit the hostfile and make something like e.g. dev.phpfreaks point to 127.0.0.1. Then I setup a new vhost.

Offline bigN

  • Irregular
  • Posts: 12
    • View Profile
Re: Zend Framework and WAMP
« Reply #5 on: January 22, 2009, 07:03:00 AM »
I also try to install and try ZF but on XAMMP.
In my httdocs I have plenty installed projects, but it seems that I cant configure the .htaccess file  ??? .....eg
I create a project in the following directory :
C:\xampp\htdocs\Quickstart
I have the below folders
application                                                                                            <DIR>
data                                                                                                   <DIR>
library                                                                                                <DIR>
public                                                                                                 <DIR>
scripts   

Now ....where should I put the  .htaccess file and what changes should I make to it?

Offline Mchl

  • Staff Alumni
  • Freak!
  • *
  • Posts: 8,582
  • Gender: Male
  • That's Largo in my avatar, not me.
    • View Profile
    • FlingBits
Re: Zend Framework and WAMP
« Reply #6 on: January 22, 2009, 07:10:40 AM »
Put it in C:\xampp\htdocs\Quickstart\public as this is where your's application will be accessible from.
NetBeans fanatic | ExtJS masochist | C++ denier
PHP4 & MySQL4 are no longer supported.
PHPFreaks Tutorials | PHP Debugging: A Beginner's guide | PHP Security Tutorial || How To Ask Questions The Smart Way
Flingbits tutorials | Class Autoloading

Offline bigN

  • Irregular
  • Posts: 12
    • View Profile
Re: Zend Framework and WAMP
« Reply #7 on: January 22, 2009, 07:53:51 AM »
Thanks..... I have installed the "ZendFrameworkQuickstart" application on my XAMMP under the folder C:\Program Files\xampp\htdocs\Quickstart
but when I run a
http://localhost/Quickstart/public/

get the error.....

Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\Quickstart\public\index.php on line 12

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='C:\Program Files\xampp\htdocs\Quickstart\application\/../library;.;C:\Program Files\xampp\php\pear\') in C:\Program Files\xampp\htdocs\Quickstart\public\index.php on line 12

I think I should change the htaccess and perhaps bootstrap but don't understand where and what path should I put????

Offline bigN

  • Irregular
  • Posts: 12
    • View Profile
Re: Zend Framework and WAMP
« Reply #8 on: January 22, 2009, 07:58:51 AM »
Sorry for the last question.....things are started working now.....
some files just haven't been copied in the library folder.....
thanks

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
No public folder???
« Reply #9 on: June 17, 2009, 06:54:07 AM »
BUMP!

I'm having similiar problems (I have a WAMP setup). Working through their quickstart guide, I successfully created the project - but when I try to navigate to the project folder - all the folders are visible EXCEPT public. When I try to access this folder, I get an internal server error. Any ideas?

example:

[DIR]   application/    
[DIR]   library/    
[DIR]   tests/

where's freaking public!?

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #10 on: June 17, 2009, 06:58:33 AM »
Sounds to me like you've actually put application, library and tests within your public directory.

Anyways, you people really ought to look into how to configure vhosts on Apache instead of panting all your projects within one single document root.

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #11 on: June 17, 2009, 07:52:36 AM »
Sounds to me like you've actually put application, library and tests within your public directory.

do you mean wamp's www directory?
Basically, I created the project within wamps www directory because (as I understand it) it needs to be in there to parse the PHP correctly.
All the folders are in one location:

C:\wamp\www\sites\study\Zend\quickstart :(application, library, public, tests)

ZF is here - and reference via the include_path in php.ini

C:\wamp\ZendFramework

Is that problematic?

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #12 on: June 17, 2009, 07:59:10 AM »
No its not problematic, but the only files out of that entire structure that need to be within an accessible web root are the files within public (eg; .htaccess and index.php). The rest can be wherever you like.

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #13 on: June 17, 2009, 08:09:41 AM »
to be fair, they were all unpacked to a single project folder when I executed "zf create project quickstart" from the cmd (as in the quickstart tutorial on Zend's site).
So why is public not visible to localhost?
« Last Edit: June 17, 2009, 08:11:55 AM by sunwukung »

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #14 on: June 17, 2009, 08:18:00 AM »
Quote
to be fair, they were all unpacked to a single project folder when I executed "zf create project quickstart" from the cmd (as in the quickstart tutorial on Zend's site).

Indeed. But you can easily setup a virtual host on apache to make public the only publicly accessible directory. Hence, why its named public.

Quote
So why is public not visible to localhost?

I've no idea. Where is your servers document root?

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend Framework and WAMP
« Reply #15 on: June 17, 2009, 08:39:06 AM »
You must be doing something wrong. When running it I get what I've attached here.

[attachment deleted by admin]

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #16 on: June 17, 2009, 08:40:45 AM »
DocumentRoot "c:/wamp/www/" -

if I modify it to
"C:\wamp\www\Sites\study\Zend\quickstart\public"

it still doesn't work. I'm going to try out the vhosts option, but this seems like quite an odd bug.

« Last Edit: June 17, 2009, 08:45:16 AM by sunwukung »

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #17 on: June 17, 2009, 08:44:24 AM »
So, your saying when you go to http://localhost/sites/study/Zend/quickstart you get a directory listing showing....


[DIR]   application/   
[DIR]   library/   
[DIR]   tests/


and no public directory? Something is whack with your setup.

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend Framework and WAMP
« Reply #18 on: June 17, 2009, 08:47:42 AM »
Does the public folder not show up in the filesystem either?

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #19 on: June 17, 2009, 08:50:52 AM »
Does the public folder not show up in the filesystem either?

Nah, I think the op has stated the public directory shows in his filesystem, but not when view via apache directory browsing.

Makes me think he has somehow installed application, library and tests into public. Seems odd though.

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend Framework and WAMP
« Reply #20 on: June 17, 2009, 08:54:35 AM »
sunwukung is not the OP though. He jumped in later.

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #21 on: June 17, 2009, 09:02:12 AM »
Indeed. I guess I should refer to him as 'the problem at hand'? :)

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #22 on: June 17, 2009, 09:47:31 AM »
Feel free - as long as you help me solve it!

yup, you're telling me. Can't figure it out for the life of me. I work with WAMP on a daily basis, so I can't understand why it wouldn't show a folder - and all my other projects are functioning fine. Incidentally, @Daniel10, I unpacked your tarball into the same folder, and still no public folder.

Anyway, here's some progress - I removed the htaccess file form within the public folder - it became visible, and now I've been able to access the framework. Soooo, it's something to do with the .htaccess I guess. Since neither vhosts or .htaccess are my strong suit, can you think of why this might be causing an issue?

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend Framework and WAMP
« Reply #23 on: June 17, 2009, 09:54:40 AM »
Okay, seriously, check this out:

C:\windows\system32\drivers\etc\hosts:
Code: [Select]
127.0.0.1 dev.yourproject
C:\path\to\your\httpd.conf:
Code: [Select]
<VirtualHost *:80>
ServerName dev.yourproject
DocumentRoot C:\path\to\your\zfproject\public
<Directory C:\path\to\your\zfproject\public>
Order deny,allow
Deny from all
Allow from 127.0.0.1
AllowOverride All
</Directory>
</VirtualHost>

Restart Apache, go to http://dev.yourproject

If that doesn't work, something is seriously wrong with your setup.

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #24 on: June 17, 2009, 10:18:33 AM »
Nope, same problem. Not sure what the problem is, only that it seems to work if I remove the .htaccess file:
Code: [Select]
SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

I'll try this on a different WAMP setup to see if it's just my current setup.
« Last Edit: June 17, 2009, 10:20:08 AM by sunwukung »

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: Zend Framework and WAMP
« Reply #25 on: June 17, 2009, 10:20:16 AM »
Either way, you're not supposed to see the public folder in any directory listing through Apache. It's supposed to be your DocumentRoot.

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #26 on: June 17, 2009, 10:26:03 AM »
sure, I get that. I'm new to all this - so I'm just trying to setup ZF as an experiment. I'll try and configure a vhost next - thought not entirely sure how to go about it.

Anyway - I've found the problem:

http://www.icyphoenix.com/viewtopic.php?f=2&t=4935

WAMP has to have the rewrite module enabled or it chokes on local .htaccess. I've activated the module and public is now accessible.


Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: Zend Framework and WAMP
« Reply #27 on: June 17, 2009, 05:57:10 PM »
And, Daniel posted a simple vhost example so now your set.

Offline sunwukung

  • Irregular
  • Posts: 29
    • View Profile
Re: Zend Framework and WAMP
« Reply #28 on: June 17, 2009, 07:25:30 PM »
Thanks for your help, I've got the vhost working now and the framework is all set up. Now for the hard part....

Offline abhiavs

  • Irregular
  • Posts: 1
    • View Profile
helper and scripts directories
« Reply #29 on: July 03, 2009, 04:28:53 AM »
tell me d use of helper and scripts directories in the application/view directory of a php project

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,177
    • View Profile
Re: [SOLVED] Zend Framework and WAMP
« Reply #30 on: July 03, 2009, 04:45:23 AM »
The helpers dir is for storing helpers, while the scripts dir is for your views.

This is of course provided you are using a default config.
« Last Edit: July 03, 2009, 04:46:42 AM by thorpe »