HomePHP Page 2 - Commercial Break (A phpAds Primer)
Getting Started - PHP
Wanna make some money from your Web site? The simplest way tostart is by opening it up to advertisers - and if you decide to go thatroute, you're going to need a capable banner management program to helpyou keep track of customers, banners and clicks. Lukily, we've got justthe thing - say hello to phpAds.
Let's start with the basics - what the heck is phpAds, anyhow?
phpAds, in the words of its author, is "a banner management and tracking system" for Web sites. It allows Web administrators to manage advertisers and advertiser banners on a Web sites, display them in a random or pre-defined arrangement, and deliver reports based on user impressions per banner. It's also pretty popular, and quite a few Web sites use it to manage their online advertising activities.
The first thing is to make sure that you have everything you need for a successful installation of phpAds. Typically, you'll need a PHP-compliant Web server (I'm using Apache), and a MySQL database server. Most Web hosting providers already offer these three components; however, in case yours doesn't, you can get Apache from http://www.apache.org, PHP from http://www.php.net and MySQL from http://www.mysql.com.
Once you've got all three packages configured and installed, download a copy of phpAds from the official Web site at http://www.phpwizard.net/, and uncompress it to a location under your server root.
$ tar -xzvf phpAds_1.4.0.tar.gz
Next, create a MySQL database to store all the application
information. Drop to a command prompt, and start up the MySQL client.
$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7311 to server version: 3.23.39
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Create a new database for the application (I've called mine
"phpads").
mysql> CREATE DATABASE phpads;
With the database created, it's time to set up all the
required tables. This isn't as hard as it sounds - the phpAds distribution comes with a single SQL file, "all.sql", which contains all the SQL commands needed to set up the application's database tables. All you need to do is execute these commands via the MySQL's server's client program.
$ mysql -D phpads -u root -p < /usr/local/apache/htdocs/phpAds/all.sql
Once the tables have been created, you need to set some
configuration parameters so that the application knows where to find the database. Locate the "config.inc.php3" file in the application directory, pop it open it in your favourite text editor and modify the following parameters:
// MySQL hostname
$phpAds_hostname = "localhost";
// MySQL username
$phpAds_mysqluser = "root";
// MySQL password
$phpAds_mysqlpassword = "";
// The database phpAds lives in
$phpAds_db = "phpads";
// phpAds' database tables
$phpAds_tbl_adclicks = "adclicks";
$phpAds_tbl_adviews = "adviews";
$phpAds_tbl_banners = "banners";
$phpAds_tbl_clients = "clients";
$phpAds_tbl_session = "session";
$phpAds_tbl_acls = "acls";
// The URL to your phpAds-installation
$phpAds_url_prefix = "http://www.melonfire.com/phpAds";
Most of these parameters are self-explanatory - the database
name, username and password, and the URL of the location the application is installed to. Once you've made the necessary changes, save the file, and attempt to access the application URL through your browser. If phpAds has been successfully installed and configured, you should see something like this:
Aaaaaand you're done! Flip the page to find out how you can begin using the application.