phpPgAds  Home 

 

 

 

  2.1Installation 

 

You have downloaded phpPgAds and want to give it a try. This chapter will tell you how to install phpPgAds correctly and will help with the configuration of PHP and PostgreSQL.

 
  
  2.1.1Copying phpPgAds to the web server 

 


The first step is to expand the downloaded file to a directory on the web server.
If you are using a Windows system you can use a tool like WinZip to expand the tar.gz or .zip file.
On a *nix based web server to can use the tar command to expand the tar.gz file.

tar xvfz phpPgAds_x.tar.gz

The next step is to move the directory to the document root of your web server.

 

 
  
  2.1.2PHP configuration 

 


Before changes the configuration of PHP you need to make sure this is needed, perhaps your installation of PHP is already configured correctly for phpPgAds to work.
You can determine the configuration of PHP by creating a small php file containing the following text:

<?php
  phpinfo();
?>

PHP needs to be configured in a certain way to get phpPgAds working correctly. You can change the configuration of PHP by editing the php.ini file. If you are using PHP as an Apache module you need to restart the web server before the changes are in effect.

PHP must be configured to have magic_quote_gpc=on and magic_quotes_runtime=off.

If you need more information about the configuration of PHP, please read the PHP documentation.


.htaccess for PHP4
If you can't edit the php.ini file, for example if you are sharing the server with other users and your ISP doesn't allow this, you could try placing a file called .htaccess in the phpPgAds directory.
The contents of the .htaccess for PHP4 is:

php_flag magic_quote_gpc on
php_flag magic_quotes_runtime off


PHP extensions
phpPgAds can work pretty well on a standard PHP installation, but some features depend on the availability of a PHP extension.

If you want to display graphs in the admin interface you need to install the GD extension. The version of the GD extension is not really important. phpPgAds will automatically detect which version is installed and will use the right image format.

If you want to use Web server stored banners in FTP Mode, PHP must be configured to support at least one of the following extensions: the FTP module (best), the CURL module or URL fopen wrappers.

 

 
  
  2.1.3Preparing the database 

 


Before you can use phpPgAds you will have to create the database phpPgAds will need to use. Some ISPs will only allow you to use one database for the whole site; in that case you can simply use this database.

The next step is to create all the tables. The table descriptions are location in the all.sql file. The easiest way to automatically create the tables is to use a tool like phpPgAdmin to upload the all.sql file to the database server. phpPgAdmin can be downloaded from www.greatbridge.org/project/phppgadmin.

If you want to manually upload the all.sql file to the database server you can use the command line PostgreSQL client.

psql -h db-server -U db-user db-name < all.sql


Privileges

If PostgreSQL works with a privilege system to increase security, you need to make sure it is configured to allow phpPgAds to execute SELECT, INSERT, REPLACE, DELETE, CREATE TABLE and DROP TABLE queries. The last two are only needed if you want to convert verbose stats to compact stats.

More information about PostgreSQL privileges can be found in the PostgreSQL manual.


 
  
  2.1.4Automatic maintenance 

 


The file maintenance.php located in the directory maintenance must be run every day. The file maintenance is responsible for emailing reports to clients and deactivating / activating campaigns.


Scheduling on *nix based servers

If you are using a *nix based servers, such as Linux or BSD you can use the cron daemon to automatically run the maintenance.php file.

You can add the following line to your crontab. The example below is displayed as two lines, but must be added as one line! Instead of fetch, you can also use wget or lynx -dump to call the maintenance file.

59 23 * * * fetch -o - http://www.server.com/phpPgAds/maintenance/maintenance.php
>> /var/log/messages


Scheduling on Windows NT/2000 based servers

If you are using a Microsoft Windows 2000 based server you can use the 'Scheduled Task' to automatically run the maintenance file. A Windows NT based server can be configured to run a certain task with the at command.

For more information about scheduled task on Windows based servers, please read the documentation provided by Microsoft.