Skip to content

Instantly share code, notes, and snippets.

@ezimuel
Created Mar 14, 2017
Embed
What would you like to do?
Create a PHP deploy package .zpk for Zend Server
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
<?xml version="1.0" encoding="utf-8"?>
<package version="2.0" xmlns="http://www.zend.com/server/deployment-descriptor/1.0">
<type>application</type>
<name>API</name>
<summary>API description</summary>
<version>
<release>1.0</release>
</version>
<appdir></appdir>
<docroot></docroot>
</package>

Deploy a simple PHP application

You need to have a deployment.xml for Zend Server and a .htaccess file for Apache. You need to edit the deployment.xml file according to your needs. You can optimize the composer autoloading, running the following command:

composer update --no-dev --prefer-dist --optimize-autoloader

You can execute the zip command to create the .zpk:

zip -r <package>.zpk <project_files> .htaccess deployment.xml vendor

You can upload the <package>.zpk file using the Zend Server management web interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment