Frequently Asked Questions relating to PHP hosting service

When I try to run PHP scripts on my website, the code is not interpreted and is being displayed in plain text.

You probably do not have the PHP feature enabled on your virtual server. PHP is supported on packages starting from ThePromoter and above. If you have purchased either of those, do not hesitate to contact the Technical Support team to have this installed.

I am getting a "Error 502 Bad Gateway" error when trying to call a PHP script on my website.

This error is produced by the PHP engine, when it cannot find the specified php file. Check that you are calling the script from the correct location and that the casing of the filename is correct. Remember that our servers are UNIX and are therefore case sensitive.

http_referer function is not working

The http_referer function does not work with Internet Explorer 6. This is a result of a security patch performed by Microsoft to overcome some weaknesses. The function works fine when run with any other web browser e.g. Mozilla.

Using a PHPv3 script, I am getting "Call to unsupported or undefined function get_input()" Error.

PHPv3 does not have the command get_input . Change extension of the file to .php4 and the problem will be solved.

How can I disable GET POST COOKIE for php: php_flag magic_quotes_gpc off does not work.

Here is a small piece of code to be placed at the beginning of each one of your scripts which will simulate magic_quote_gpc=OFF, i.e. no \ added in front of special characters in form fields.

<?php

if ((get_magic_quotes_gpc() == 1){

switch ($REQUEST_METHOD)

{

case "POST":

while (list ($key, $val) = each ($HTTP_POST_VARS)){

$$key = stripslashes($val);

}

break;

case "GET":

while (list ($key, $val) = each ($HTTP_GET_VARS)){

$$key = stripslashes($val); }

break;

}

}

?>

Simply put that code as an include into your scripts.

How can I change the sender address from [nobody@cthulhu.netregistry.net] when using PHP to process email.

You have to write a script that uses SMTP on localhost to have the sender set to something other than nobody.

How can I disable register globals?

You cannot. This is a global setting in our shared hosting environment and we cannot change it on request, as it will interfere with other clients virtual servers. You just need to ensure that variables are initialised before use, to prevent poisoning.

I have a phpdig problem.

To summarise the code,

file() reads the file into an array;

implode() turns an array into a string;

fwrite() writes a string into a file.

Change the code in phpdig to:

$fhandle = fopen($uri, "rb");

$file_content_string = fread($fhandle, 10000000);

to read the file where 100000000 is a max file length to read and

$f_handler = fopen($tempfile1,'wb');

if (is_array($file_content)) { fwrite($f_handler,$file_content_string);

}

fclose($f_handler);

to write the file, which is the same as the orignal without the implode().

fread() is a binary safe file read into a string, which should work happily. If otherwise, please contact the Technical Support team with the location of your script.

Php.ini file is set to use cookies for the session control and creates a problem for secure scripts as 4tknox.au.com has a different setup. How can I fix this?

As 4tknox.au.com is a different domain, the cookie for a virtual host was not being carried over to the secure script. It just creates another cookie, and then loses the session variables which are set on a virtual host, these variables are needed in the scripts being run from the secure side.

The solution is to set session_use_cookies to off and manually pass the sessionid variable between the scripts on the different domains, therefore ignoring any cookies and pointing straight to the session file on the server.

Or, another solution is to use database session handler described here.

© 1997- 2008 Netregistry Pty Ltd