I’m using home.pl to host some of my projects. Also, this is test platform for some of the application I work on. At some point I started using Zend Framework and when tried to use home.pl to host Zend Framework-based project went into bit of trouble. By default there is no shell access, so no way to manipulate httpd settings.

After few emails with Technical Support from home.pl I received step-by-step instructions from them on how to create Zend Framework-based project and make it run correctly, so I thought it is worth to share.

In order to create Zend Framework-based project you need to download Zend Framework from Zend Download web page (http://www.zend.com/en/downloads/), uncompress downloaded archive and upload to home.pl server.

For the purpose of that description I assume that uncompressed folder with Zend Framework content is named zf and uploaded to main folder of the hosting account at home.pl, so absolute path will be /zf.

1. Creating shell script to create Zend Framework Project

In folder /zf/bin edit file zf.sh to look as follows:

if test "@php_dir@" != '@'php_dir'@'; then
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
while test -n "$SELF_LINK_TMP"; do
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
PHP_DIR="$(dirname "$SELF_LINK")"
"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@"

Make sure that zf.sh will have executable attribute set. (chmod +x zf.sh)

2. Triggering shell script via web browser

In folder /zf create file project.php (or another name of your choice) with following content:

system('bin/zf.sh create project project1'); ?>

Project1 in the example is the name of your project you want to create.
Now we can run the file in web browser:
http://yourdomain/zf/project.php (yourdomain is your domain hosted on home.pl account which can be used to reach to /zf folder via browser)

After a while you will see following information in the web browser window:
Creating project at /zf/project1 (…)
That means Project1 has been successfuly created.

3. Creating Symbolic Link for Zend Libraries

Now we go to /zf/project1/library folder. We have to create symbolic link to /zf/library/Zend. As there is no access directly to shell we use PHP to create link. In order to do that create file symlink.php (name of that file might be different) with following content:

system('ln -s ../../library/Zend/ .');

Created file we can run in web browser:


From now on you can see Zend Framework Welcome page under http://yourdomain/zf/project1/public/

4. Poiniting URL to Zend Framework project

Due to restrictions on home.pl we can’t point our domain to subfolder of the Zend Framework as indicated in documentation as that would prevent our application from accessing folders above in folder structure. So, domain has to be pointed to root folder where /zf folder is created with Zend Framework. In that folder we can place .htaccess file which will provide appropriate information to web server how to access and serve content of our application. Then point domain to root folder of your account.

File /zf/.htaccess should look like:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domena\.pl$ [NC]
RewriteCond %{REQUEST_FILENAME} !/zf/projekt1/public/
RewriteRule ^(.*)$ /zf/projekt1/public/$1 [L]

Last line of .htaccess file should be empty. Once domain will be pointed correctly to root folder of your hosting account, you will see Zend Framework Welcome page when you open domain in web browser.

5. Modification to Redirector.php

In order to avoid error 500 when using redirector in helper application you need to one of the following changes:

a. in file /zf/library/Zend/Controller/Action/Helper/Redirector.php

change line:

protected $_useAbsoluteUri = false;


protected $_useAbsoluteUri = true;

b. in each controller in init() function you have to add:


Regardless which solution you will choose (a. or b.) it will be possible to use redirections without any problems using function:

In order to use sessions in Zend Framework, make sure that in root folder you have /tmp folder.

I hope that will be helpful for developers who are placing Zend Framework-based projects on home.pl as hosting provider/platform.