0

I am installing zend framework 2 on my shared hosting server. So far I did the steps below.

  1. downloaded the ZF2 skeleton application and uploaded to my public_html. I have config, data, module, public, vendor, and init_autoloader.php in "public_html" folder on my server at this moment.

  2. downloaded the full package (ZendFramework-1.12.9) and copied "library" folder and placed it under public_html/vender/ZF2/ so that it would work in init_autoloader.php

  3. created .htaccess in which I entered below:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !.(js|ico|txt|gif|jpg|png|css)$ index.php

  4. created index.php and placed it under public_html/. The content is below:

    <?php 
    define('RUNNING_FROM_ROOT', true);
    include 'public/index.php';
    ?>
    
  5. I opened a browser and ran the url (pbm.pbmarketing.ca).

I have got a fatal error message below:

Fatal error: Class 'Zend\Loader\AutoloaderFactory' not found in /home/pbmarket/public_html/pbm/init_autoloader.php on line 44

What step did I do wrong? Could you please help me with this issue?

jmleroux
  • 947
  • 6
  • 17
  • 2. downloaded the full package (ZendFramework-1.12.9) - this is ZF1 not ZF2!? public_html/vender/ZF2/ Shouldn't it be vendor? – Zdenek Machek Nov 12 '14 at 23:22

1 Answers1

2

Once you have the skeleton app, use Composer to install ZF2 (see the instructions here: http://framework.zend.com/manual/2.3/en/ref/installation.html). Since you're on shared hosting you may need to do this before uploading the files. You don't need to do download ZF itself (and not ZF1!)

I've not used ZF2 on shared hosting, so can't help you with that side of it, but the error you're currently getting is because you don't have any of the ZF2 files.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
  • Tim is right. There are so many libraries using composer, that almost every php project should be using it. – Janis Peisenieks Nov 11 '14 at 21:20
  • Thanks for your info, Tim. I actually was able to install Zend Framework 2 in xampp on my local machine. I would like to know how to install it on a dedicated server then. Let's assume that I have a subdomain called pbm.pbmarket.com under www.pbmarket.com on my dedicated hosting server. Would it be possible to install zend framework 2 on pbm.pbmarket.com? If so, could you help me with how to do it? Thanks in advance. – user3922691 Nov 12 '14 at 14:25
  • The process isn't different, although you might wish to run the composer commands on the server instead. – Tim Fountain Nov 12 '14 at 14:45
  • Thanks Tim. I will have to install composer on my server then? – user3922691 Nov 14 '14 at 13:04