Posts Tagged ‘PHP’

I’ve put up my site but I still see the standard index page. What’s up?

You may be seeing a cached version of the page; please force refresh the page in the browser by simultaneously pressing Ctrl and F5 or delete all the cache/stored pages in the options/settings menu of your browser. If this doesn’t help, check you’re putting your site in the right place; it should go under the “public_html” folder.

If your site is written in PHP, the default index.html page may still be visible – you should delete this in order to show your site.

How do I connect to my MySQL database?

A simple php script to open a connection to a database

<?php
$dbhost = ‘localhost’;
$dbuser = ‘db username’;
$dbpass = ‘db password’;

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);

$dbname = ‘db name’;
mysql_select_db($dbname);
?>

Save this as <something>.php and then whenever you want to access the database, just add

include ‘<something>.php’

to the top of a php script and the database can be queried using standard sql commands.

Can you set “register_globals” to ON in PHP for me?

Such a global change to the php.ini config is a well known security risk and affects all other customers and isn’t something we’d consider doing. However you can set that and any other variable using the method below.

You can create your own php.ini file inside whatever sub-directory your script is in. You can then determine the exact behaviour for your PHP scripts yourself.

There’s a lot of documentation on how to use the various configuration features inside php.ini online at http://uk2.php.net/configuration.

In this case, to set “register globals” on, you can just create a file called “php.ini” in the subdirectory of your website that the script is in, simply saying:

register_globals = on

Please note: if you have enabled PHP5, you will need to call this file “php5.ini” rather than “php.ini”.

Search WoWHost
Customer Info/Advice
Copyright and TM 2007-2010 WoW-4.co.uk