Your regular expression is missing the delimiters, as PHP should have warned you:
$_SERVER['HTTP_REFERER'] = 'http://myWebsite.com/foo.html';
var_dump( preg_match('^/http:\/\/myWebsite\.com\/', $_SERVER['HTTP_REFERER']) );
... triggers:
Warning: preg_match(): No ending delimiter
Since you are allowed to choose your own delimiter, it's simpler to pick one that's not in the text:
preg_match('@^http://myWebsite\.com/@', $_SERVER['HTTP_REFERER'])
Additionally, if the text is not fixed (not this case I presume), PHP can escape it for you:
preg_match('/^' . preg_quote('http://myWebsite.com/', '/') . '/', $_SERVER['HTTP_REFERER'])
I suggest you configure your development box to display all possible errors. You have several ways to do so:
Edit your php.ini
file:
error_reporting = E_ALL | E_STRICT
display_errors = On
Put this on top of your script:
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', TRUE);
If PHP runs as Apache module, you can also use an .htaccess
file:
# Print E_ALL | E_STRICT from a PHP script to get the appropriate number:
php_value error_reporting 2147483647
php_flag display_errors on