Zend Server Free Edition – How to Remove Vhost Previously Created in Trial Mode

Synopsis

While using Zend Server in Trial mode, a vhost was created using the Zend Server UI - Applications | Virtual Hosts page.
Later on, Free edition license was registered, and the capability to manage vhosts is not available anymore (see Zend Server Editions page for more details).

Solution

The following "recipe" is a manual process meant to remove any Apache virtual hosts created by the Trial / Enterprise version.

Notes:
You should run these commands as root / sudo!
You can run these commands line by line, just replace $vhname/$vhport with the actual vhost name and TCP port you wish to remove.
Zend Server Daemon should be able to automatically parse virtual hosts created manually in your distribution's Apache configuration. If this does not happen, try restarting ZSD – /usr/local/zend/bin/zendctl.sh restart-zsd

 

#!/bin/bash
vhname=myvhost.com
vhport=80
rm /usr/local/zend/etc/sites.d/vhost_http_$vhname_$vhport.conf
rm -r /usr/local/zend/etc/sites.d/http/$vhname
cp /usr/local/zend/var/db/zsd.db{,-orig}
sqlite3 /usr/local/zend/var/db/zsd.db "delete from ZSD_VHOSTS where name = '$vhname';"
/usr/local/zend/bin/zendctl.sh restart-apache
echo "Done!"