1

I have a xampp serwer on windows XP: Apache 2.4.3 PHP 5.4.7

and I try to start learning Zend2.

I downloaded skeleton app: https://github.com/zendframework/ZendSkeletonApplication and run from cmd:

php composer.phar self-update
php composer.phar install

(not that I had to give a full link to php like C:\xxx\php.exe - I don't know why, I have php in my enviromental variables). It went ok - no errors.

I added this code to httpd-vhosts.conf :

<VirtualHost *:80>
    ServerName zf2-tutorial.localhost
    DocumentRoot /zf2-tutorial/public
    SetEnv APPLICATION_ENV "development"
    <Directory /zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

I also added this line to C:\WINDOWS\system32\drivers\etc\hosts

127.0.0.1               zf2-tutorial.localhost localhost

When I run

http://zf2-tutorial.localhost 

in the browser I get "Permission denied"

When I try

http://localhost/zf2-tutorial/public/ 

I get very long php error

Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\InvalidArgumentException' with message 'Provided abstract factory must be the class name of an abstract factory or an instance of an AbstractFactoryInterface.' in C:\xampp\htdocs\zf2-tutorial\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:302 ...........

I figure sth is wrong with serwer since I get "Permission denied". What I am doing wrong? Thx in advance.

BIg Thanx Everyone. My final config:

<VirtualHost *:80>
    ServerName zf2-tutorial.localhost
    DocumentRoot C:/xampp/htdocs/zf2-tutorial/public
    SetEnv APPLICATION_ENV "development"
    <Directory C:/xampp/htdocs/zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

127.0.0.1               zf2-tutorial.localhost

Works fine on: http://zf2-tutorial.localhost/

baron_bartek
  • 1,073
  • 2
  • 20
  • 39
  • 1
    Please see here: http://stackoverflow.com/questions/16359394/zf2-skeleton-application-is-throwing-500-error – cyber2200 May 04 '13 at 10:58
  • Thanx. This solved the problem with starting the skeleton app but I can only run it on `http://localhost/zf2-tutorial/public/` any idea why the vhosts don't work for `http://zf2-tutorial.localhost` – baron_bartek May 04 '13 at 14:01
  • I'm facing the same issue. But it appears to be a bug, found this https://github.com/zendframework/zf2/issues/4403 on the github issue tracker for zf2 (comment from weierophinney) We'll just have to wait for a fix, I'm afraid. – Sam May 06 '13 at 06:01

2 Answers2

2

Your hosts file is incorrect. Instead of:

127.0.0.1               zf2-tutorial.localhost localhost

Remove the last "localhost", so you get:

127.0.0.1               zf2-tutorial.localhost

Edit: Another thing I just noticed is your DocumentRoot: this should be the fully qualified path to your document root: i.e. C:/www/zf-tutorial/public. Note that you should use forward slashes for directory separators. Use the same path in your Directory configuration to make sure that access is allowed to that directory.

Ruben
  • 5,043
  • 2
  • 25
  • 49
  • Thank you for reply. Unfortunatelly it didn't work. Now I get permission denied on both `http://zf2-tutorial.localhost` and `http://localhost/zf2-tutorial/public/` – baron_bartek May 04 '13 at 08:09
1

It seems you are using Windows, so your vhost configuration should contains Windows alike path to your project. Are you sure that you have valid path to php\bin in your %PATH%?

> echo %PATH%

I am using XAMPP on Windows 7. Here is my vhost configuration:

<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "C:/xampp/projects/zf2-tutorial/public"
    ServerName zf2.tutorial
    ##ServerAlias www.dummy-host2.localhost
    SetEnv APPLICATION_ENV "development"
    <Directory C:/xampp/projects/zf2-tutorial/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
    </Directory>
    ErrorLog "logs/zf2.tutorial-error.log"
    CustomLog "logs/zf2.tutorial-access.log" combined
</VirtualHost>

This one is essential (probably also in your case):

    <Directory C:/xampp/projects/zf2-tutorial/public>
        # ...
        Require all granted
    </Directory>
Tomasz Kuter
  • 656
  • 8
  • 12