Jump to content

Archived

This topic is now archived and is closed to further replies.

ma2tt

[SOLVED] Zend Framework and WAMP

Recommended Posts

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

Share this post


Link to post
Share on other sites

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\

 

Share this post


Link to post
Share on other sites

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.

 

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.

 

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Put it in C:\xampp\htdocs\Quickstart\public as this is where your's application will be accessible from.

Share this post


Link to post
Share on other sites

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????

Share this post


Link to post
Share on other sites

Sorry for the last question.....things are started working now.....

some files just haven't been copied in the library folder.....

thanks

Share this post


Link to post
Share on other sites

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!?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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.

 

So why is public not visible to localhost?

 

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

Share this post


Link to post
Share on other sites

You must be doing something wrong. When running it I get what I've attached here.

 

[attachment deleted by admin]

Share this post


Link to post
Share on other sites

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.

 

 

Share this post


Link to post
Share on other sites

So, your saying when you go to http://localhost/sites/study/Zend/quickstart you get a directory listing showing....

 

[pre]

[DIR]  application/   

[DIR]  library/   

[DIR]  tests/

[/pre]

 

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

Share this post


Link to post
Share on other sites

Does the public folder not show up in the filesystem either?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Indeed. I guess I should refer to him as 'the problem at hand'? :)

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Okay, seriously, check this out:

 

C:\windows\system32\drivers\etc\hosts:

127.0.0.1 dev.yourproject

 

C:\path\to\your\httpd.conf:

<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.

Share this post


Link to post
Share on other sites

Nope, same problem. Not sure what the problem is, only that it seems to work if I remove the .htaccess file:

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.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.