Is there a way to put the zip file in PHP's include_path?

Copying the Zenf Framework around the world is a nightmare, so I got the idea that deployment would be faster if the whole framework is just a zip file. Is there a way to do this? Would it be very ineffective?

-1


a source to share


5 answers


You only really need to deploy it once per server, so it's not much of a nightmare.

But the answer to your question is if you mean that you can just include one ZIP file, then no. However, to ease the pain of deployment, you can download the ZF as a zip file to the server and then extract it to a remote machine. This is significantly faster than downloading gazillion files individually.



Edit: Actually you could implement your own version of Zend_Loader that knows how to handle zip files. I very much doubt that he will act wisely. This is likely to cause more problems than it solves.

+2


a source


There is 5.3 (although it can also be installed as a PECL module). PHAR files - http://pecl.php.net/phar and http://www.php.net/phar . However, running something larger than the entire ZF infrastructure, where most of it will be used in most cases, would be overkill. I think it's likely that when PHP5.3 is released, significant parts of it will also be released as .PHAR files for use.



Until then, no. However, copying it is just a one-time deal. You can also download the original .tgz file and unzip it on the server.

+2


a source


It seems to me that you still need to unpack it, but it doesn't need to be copied into every project. Let's say you have a directory structure like this:

/htdocs
    /library
        /Zend
    /Project1
        [...]
        /public
            index.php
    /Project2
        [...]
        /public
            index.php

      

Then just edit the include path in index.php for Zend_Framework from. / library:

../../library

      

0


a source


If you are working in a Unix-based environment, adding a symbolic link to the Zend folder in the project library folder will also work:

% cd /your/project/library
% ln -s /path/to/ZendFramework/library/Zend .

      

0


a source


You can use the PHAR [1] extension to control this :) The PHAR extension allows you to use something like:

include 'phar:///path/to/zend-latest.tgz/file.php';

      

PS: PHAR can also handle .zip or .tgz files.
I hope this helps. Greetings.

1: http://php.net/phar

0


a source







All Articles