Hosting Account Tips & Tricks

Thank you for choosing Gogo as your web hosting providor. This document contains useful information to assist you in getting the most out of the web hosting environment.

Selecting PHP 4 or PHP 5 for your web hosting.

Your Gogo Internet Services Limited web hosting system is able to run either PHP 4 or PHP 5, or with a little extra work, both.

Initially it is setup to run files in this way...

*.php- are run as PHP 5
*.php4- are run as PHP 4
*.php5- are run as PHP 5

To change to running *.php files as PHP 4, simply add the following line to a file called .htaccess in your public_html directory.

AddHandler application/x-httpd-php .php

If you wish, you could add this line to a .htaccess file in another directory and then only requests for *.php within that directory (or subdirectories) will be run as PHP 4.

^ top

Making PHP ini settings

To make a PHP ini setting, you have two choices. You can either supply a complete php.ini file, or you can supply one or more additional ini files which contain only specific settings you wish to change.

Some software packages may instruct you to add php_flag or php_value settings to an .htaccess file, due to tighter security here at Gogo this is not available so you must instead use one of the methods below. Please feel free to contact us for assistance in configuring the server to match your software.

^ top

php.ini File method

Simply place the php.ini file you want in the same directory as the php file that is being requested.

^ top

_custom_php_settings method

Create a directory called _custom_php_settings in the same directory as the php file that is being requested, inside this directory you can create as many ini files as your require, each will be read (in no particular order) and the ini settings applied "over the top of" the normal php.ini.

^ top

Ini Installing Tool

As noted above the php.ini file or _custom_php_settings directory needs to be in the same directory as the php file that is being requested. This is obviously a slight maintenance hassle, so Gogo has made a tool to take the headache away.

This tool is located in the tools directory of your hosting account, it is called "linkini", what it will do is propogate a single ini file or _custom_php_settings directory to all the directories with php files.

To use it, simply create an initial php.ini file or _custom_php_settings directory in your public_html, login via SSH, and run tools/linkini it will do the rest for you. You can run the tool as often as you like, it will link in any new directories and update existing ones in seconds.

linkini has some other usage options for advanced users, run "tools/linkini -h" and it will tell you about them

^ top

Strange Errors? Disable Zend Optimizer

The Zend Optimizer is enabled by default, however for some scripts the Zend Optimizer doesn't so much Optimize as uncerimoniously crash (technically it causes a Segfault in PHP). This can lead to all sorts of crazy random errors, things that should work fine don't, and in general it's really hard to track down the "bug", owing to the fact that more often than not it's not a bug at all.

If you are seeing strange failures, or the dreaded white-page-of-death, then try adding zend_optimizer.optimization_level=0 to your php.ini file.

Gogo Wildshare Security Certificate

In your welcome email you will have been given a "Gogo Wildshare Security URL". Wildshare is an initiative by Gogo Internet Services Limited to provide, free of charge, a real security domain of the form http://[yoursitename].thesecurityvault.net/ many providor offer a domain of the form https://somestrangedomain.com/~YourUserName/ however this provides certain complexities to developers and also appears less "professional" to the lay person, the customer, who might think it is a "hack", normal people don't see tildes in web addresses.

There are however a couple of minor notes regarding the Wildshare. Firstly, the certificate is in the name of Gogo Internet Services Limited, it is not issued specifically to you. Secondly, behind the scenes it does work through the userdir system, that is https://yoursitename.thesecurityvault.net/ is translated (with mod_rewrite) out of sight of the user to http://phi.gogo.co.nz/~YourAccount/

This doesn't generally create a problem and will be almost invisible to the developer. However, for users who are using PHP, and make use of the $_SERVER['DOCUMENT_ROOT'] or $_SERVER['PHP_SELF'], these two values will be incorrect when using the Wildshare url. You should modify your PHP code to ether not uses these values, or simply correct them before use ($_SERVER['DOCUMENT_ROOT'] should be /home/[username]/public_html and PHP_SELF can probably be gleaned from $_SERVER['REQUEST_URI'])

^ top

Sharing/Distributing Code Between Accounts

For our customers who run multiple accounts based of the same code, you may wish to share certain PHP code, images or whatever between accounts to make maintenance easier.

For example purposes we assume you have two accounts "Master" and "Slave", where Master will contain the master copy of the shared code, to which each Slave links.

The first thing to ensure is that te permissions on the code in Master are appropriate to allow "Others" to access. We would suggest that you place the master code in /home/Master/public_html and do "chmod o+rx /home/Master/public_html" in ssh.

Once permissions are set, you have a couple of options. You could write your Slave php so that it does things like "require_once('/home/Master/public_html/Something.php')". Or you can login as Slave and do "ln -s /home/Master/public_html public_html/MasterCode", then check that it works with "ls -l public_html/MasterCode/*".

There is one gotcha to consider if you want to do an actual request (from the browser) for a php file in a different account. If so, we advise you to use a RewriteRule

RewriteEngine On
RewriteBase /
RewriteRule ^SharedCode/(.*) ~SharedAccount/public_html/$1 [PT]

The reason for this is that due the security restrictions of suexec php scripts may fail if requested from one account through a symlink to another.

^ top