Order a VPS, Semi- dedicated or Dedicated server in Dallas, London or Australia.
Ask our support team about your hosting requirements.
Host where the staff takes pride in making customers happy
Thanks for all the tips. I checked out all the HowTo pages -- very nice. Sure saved me alot of time -- researching all the packaging I need to know. Wished I'd come here for my other website development a couple of years ago.
PHP is a popular language used to create dynamic web pages. Using PHP can be as simple as putting the following code in a /var/www/html/helloworld.php file. The presumes your Apache DocumentRoot is /var/www/html. The code:
<html> <head> <title>PHP Test</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> </head>
<body> <h1>PHP Test</h1> <p> <b>An Example of PHP in Action</b><br /> <?php echo "The Current Date and Time is: <br>"; echo date("g:i A l, F j Y.");?> </p>
<h2>PHP Information</h2> <p> <?php phpinfo(); ?> </p> </body> </html>
If you then browse to http://yourserver/hellowworld.php it will output information about your Apache and PHP setup.
The following code snippet demonstrates how to get a MySQL connection:
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password")
or die("Could not connect: " . mysql_error());
print ("Connected successfully");
mysql_close($link);
?>
Are you getting an error like: Problem: mysql_connect(): Client does not support
authentication protocol requested by server?
This can happen, for example, when connecting to a MySQL 4.1 database server. Try the 'old' password format:
update user set password=old_password('yourpasswordhere') where User='yourusernamehere';
flush privileges;
If instead of executing the PHP your web browser offers you the file for download, check you haven't got a 'IncludesNoExec' directive in play in your httpd.conf file. E.g.
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
...
(If you do, just remove the IncludesNoExec option, or override it on the virtual host)
Is your test PHP script not working? E.g. if you view the source of the page do you see the <?php ... > tags?
Make sure your <Directory> has an Options line that includes ExecCGI.
e.g. Options Indexes FollowSymLinks ExecCGI
Also, make sure that your Apache httpd.conf file has the following in it:
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php
If PHP code works for your 'main' server but not for a virtual host on the same server, check the relevant Directory and VirtualHost directives. And make sure they also have the ExecCGI directive.
Are your PHP scripts failing to see URL or Form parameters when you refer to the parameters like $VariableName?
/etc/php.ini will be set with register_globals = Off ($VariableName is how
you'd reference a global variable). You could turn on globals, but the prefered way
of referencing the variables is by using syntax such as $HTTP_POST_VARS['VariableName'] -
for form POSTs - or $HTTP_GET_VARS['VariableName'] - for URL parameters.
For more information see: http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=500&lngWId=8
This error can occur when a user submits a form with more data than PHP is configured to allow. For example, when uploading a file.
To resolve the problem change the LimitRequestBody (the default is usually about 500KB) in /etc/httpd/conf.d/php.conf and restart apache.