Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Install ActiveSync on cPanel  (Read 8357 times)

0 Members and 1 Guest are viewing this topic.

Rajesh

  • Guest
Install ActiveSync on cPanel
« on: December 27, 2014, 08:06:33 pm »

ActiveSync is used to communicate with Exchange Server and RIM BlackBerry Server in order to deliver Push email to mobile devices. Z-Push is an open source implementation of this and works great with iPhone, Android, Nokia and Windows Mobile devices. To install it on a cPanel web server follow these instructions.


You will need to use Dovecot as your mail server in cPanel if that is not already the case. Then download Z-Push. You can download Z-push using this link: http://z-push.org/download/.

Extract it to /usr/local/apache/htdocs. You might want to rename the folder to something easier like /usr/local/apache/htdocs/z-push

tar zxvf z-push-<version>.tar.gz -C /usr/local/apache/htdocs
mv /usr/local/apache/htdocs/z-push-<version> /usr/local/apache/htdocs/z-push

We need to configure Z_Push to use IMAP by editing the config.php file. While you are here you also need to setup your time zone. You ca see thesupported php time zones using this link : http://php.net/manual/en/timezones.php

$BACKEND_PROVIDER = “BackendICS”;

with

$BACKEND_PROVIDER = “BackendIMAP”;

Z-Push use a php function apache_request_headers() that is only available in mod-php (php 5.4 also have it available now). To fix this we will create our own version. Edit compat.php and append the following to the end of the file before the closing ?>

if (!function_exists('apache_request_headers')) {
function apache_request_headers()
    {
        $headers = array();
        foreach ($_SERVER as $k => $v)
        {
            if (substr($k, 0, 5) == "HTTP_")
            {
                $k = str_replace('_', ' ', substr($k, 5));
                $k = str_replace(' ', '-', ucwords(strtolower($k)));
                $headers[$k] = $v;
            }
        }
        return $headers;
    }
}

We need to fix the owner of the files and fix the permissions for the state folder so that it is writable.

chown -R nobody:nobody /usr/local/apache/htdocs/z-push
chmod 777 /usr/local/apache/htdocs/z-push/state

Next we need to setup apache with an alias that ActiveSync require. Log into WHM and go to Service Configuration -> Apache Configuration -> Include Editor -> Post VirtualHost Include -> All Versions and add the following line

Alias /Microsoft-Server-ActiveSync /usr/local/apache/htdocs/z-push/index.php

You should be able to test your setup at this point. In your browser go to http://<serveripOrname>/Microsoft-Server-ActiveSync

You should be asked for you username and password. Use your e-mail account credentials to log in. One inside you should get a Z-Push screen with a message about “GET not supported”. You can now setup your mobile device. Remember to deselect SSL if you did not setup your server with SSL.

If you find any errors with your setup, you can create a debug file which will be used to log what is going on:

touch /usr/local/apache/htdocs/z-push/debug.txt
chmod 777 /usr/local/apache/htdocs/z-push/debug.txt

 ;D