PHP3 is a server side, cross-platform, HTML embedded scripting language.
PHP3 stands for Personal Home Page tools version 3.0.5. The PHP3 daemon may be
installed one of two ways, compiled into a CGI script program that parses the
data by calling a precompiled CGI program with additional arguments or compiled
directly with Apache as a module, which works like mod_perl directly with Apache
parsing specific directives. We have compiled PHP3 as a module.
To use PHP3, you have to have a UNIX Shared Host plan as
well as the MySQL
service.
It is crucial that you have a working knowledge of Perl, CGI,
HTML and SQL to effectively use this service. If you aren't sure whether or not
this service is appropriate for you, contact support@primushost.com.
Please be aware that the version of PHP3 we are currently using is UNIX-based
and thus cannot be used on any NT-based machines. Using PHP3
PHP3 is coded directly inside the HTML. It resembles comments, though with
PHP3 directives added. The correct tag to embed the PHP3 directives is <?php
... ?> (the periods represent the PHP directive that you will include).
This example shows how to print data to an HTML file (all of this is done
as the page is loaded by the browser). Files that contain PHP3 directives should
have the file extension .phtml or .php3 so that Apache (the web server) will know
to parse the data between the PHP3 directives with the PHP3 engine. This code:
<html><head><title>PHP Test</title></head>
<body> <?php echo
"Hello World";
?> </body></html> | Will
output this: Connecting to the Database
While there are many different methods you can use to connect to your database
(such as DBI or the Perl modules for mSQL or MySQL), PHP3 is one of the fastest.
You use a persistent database connection to the daemon as opposed to sending queries
to the database and interpreting their responses. As long as PHP3 has been
configured correctly the PHP3 functions that are located in your HTML file will
not be readable to the world. If you view the source of the HTML file you will
notice that the web browser blocks out the data just like comments. Here is
a short example of how to connect to a database using PHP3. The first "?php" line
defines the username, the next one defines the password, and the third defines
the host where the database is located (if this is null, it defaults to the local
host). The fourth line is the one that allows the persistent connection to your
database with the defined information.
<html><head><title>PHP
Test</title></head> <body> <?php
$user = "mysql";
?> <?php $password
= "#####"; ?>
<?php $host = ""; ?> <?php
mysql_connect("$host", "$user", "$password");
?> </body></html> |
Links Below are links to some
MySQL and PHP related web sites. Back
to Shared Hosting Support
|