Administrator documentation

Table of contents



In order to setup phpGrabComics, the following prerequisites are necessary:

Setup of these packages might be complex and is beyond the scope of this document. Please refer to the appropriate web sites for further details.

Web Standards and browser support

phpGrabComics is written to be compliant to web standards, with the purpose to demonstrate that it is possible to write accessible and usable web sites and applications:

If you find pages or fragments of phpGrabComics that are not compliant to the mentioned standards, please report the problem in phpGrabComics forums.

valid xhtml 1.1valid cssLevel Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0

phpGrabComics will work with any browser supporting W3C standards; moreover, it is checked to best work with the Mozilla (version 1.4 or newer) and Internet Explorer (version 5 or newer). Graphic appearance will be slightly different in browsers that do not fully support CSS specifications.

phpGrabComics should work very well in handheld devices and in text-only browsers. phpGrabComics has been tested on Opera in text-mode (see screenshot), and works with lynx, the text only browser.

ZaurusMoreover, phpGrabComics has been tested with success on Zaurus running Opera (see screenshot).


phpGrabComics has been tested under different Windows and Unix-like systems.

The following installation procedure is supposing that you are installing phpGrabComics in a Unix-like system.

Installation on Windows is slightly different; to install on Windows, remember that:

1) Download phpGrabComics server.

2) Uncompress the phpGrabComics archive into the directory you want to use on you web server. This may require downloading phpGrabComics to your desktop, uncompressing it and uploading it to your web server.

3) Instead of steps 4 to 8 you can use the web interface at configure.php to set up the basic options, provided that:

If your PHP is running in safe mode, the web interface will not work and you will have to go on with the manual configuration.

If inc/config.php is not writable, you can make it writable:

chmod 777 inc/config.php

The web interface is experimental, and if you don't succeed in using it, use the approach described in steps 4 to 8.

Steps 4 and 5 require a command line access to the computer where you want to install phpGrabComics. If you do not have command line access, install phpMyAdmin and use it to import the file phpgrabcomics.sql.

4) Create a database (you can skip this step if you want to use an existing database):

mysqladmin create phpgrabcomics

mysqladmin is installed with mysql. It's path is dependent on your configuration.

5) Fill the database with the tables in phpgrabcomics.sql file:

mysql phpgrabcomics < phpgrabcomics.sql

6) Edit the file inc/config.php to set up your configuration. Change all the variables according to your settings. The meaning of each variable is explained in the inc/confic.php file itself.

For security reasons, set up a user name and a password. Please note that the variable $psw does not have to contain the password, but the md5 hash of the password. You can use the file admin/md5.php for that.

Give special attention to the database configuration section.

If you want to archive any comic, include it in the $comics_updated array. This will instruct phpGrabComics to create a folder where each daily comic will be saved.

7) Change the permission for the folder comics, if you want to save the comics. You need to allow the web server to write in that directory.

chmod 777 comics

8) Change the permission for the folder tmp.

chmod 777 tmp

9) Please remember that phpGrabComics archives the comics only if the comic strip is in the $comics_updated array (in file inc/config.php) AND:

Administering the phpGrabComics server

Using getcomics.php

getcomics.php is independent from phpGrabComics, so you can run your phpGrabComics on a server, and getcomics.php on a different computer. This is done to allow you to easily update your comics from your client if your server does not support a cron job.

getcomics.php can receive parameters from the command line and/or can be configured to use default values.

Run getcomics.php -h to see what command-line options are available. Under Unix-like systems you will need to make getcomics.php executable:

chmod 755 getcomics.php

Use getcomics -V if you want a verbose report of the commands you are executing.

NOTE: getcomics.php requires allow_url_fopen be set to 'On'. Make sure this is the case in your php.ini file (see the PHP documentation).

Automatic download on Unix-like systems

phpGrabComics is very useful if you update your comics putting the program getcomics.php in your crontab file (available in Unix-like systems only, sorry).

1) change the permission to getcomics.php to make it executable:

chmod 755 getcomics.php

2) execute in your shell:

crontab -e

Modify your crontab adding the line:

0 6 * * * /home/baraval/www/getcomics.php -g -u http://server/phpgrabcomics/ -l user -p password

You need to replace the path to the file getcomics.php, the URL of phpGrabComics, the user and the password according to your settings.

3) If everything is all right, executing crontab -l will show your active jobs.

The crontab file can be highly customised. For more information on cron (the command) and crontab (the configuration file for cron), refer to their documentation.

Automatic download on Windows systems

You can customise the file docs/examples/getcomics.bat to download all the comics. It is just an interface to the file getcomics.php and can be used to program automatic downloads. Once you have configured it, just run it and it will force an update of the comics in your server.

Using phpGrabComics as administrator

phpGrabComics server allows its administrator:

These functions are not available to any other user, and only one administrator login can be set up, to ensure that is used for personal use only.

The phpGrabComics server provides as well an RSS summary of daily comics, that can be accessed using any RSS client.

When you login as administrator in a phpGrabComics server, links to functions available only to the administrator will apear.

Using the PHP interface

Include the following code in the files where you want to use phpGrabComics commands:

include ('inc/phpgrabcomics.php');

For example, to use the dilbert comic class in a page:

include ('modules/dilbert.php');

$dilbert = new Dilbert;

Then you can:

You can do the same for the other modules.

If something is not clear, look at the following examples.

The following code:

$dilbert=new Dilbert();

will include dilbert strip in your page.

This second example:

include_once("modules/" . $comic .".php");
$dilbert=new Dilbert();

allows to output the dilbert strip (not a HTML page, the dilbert strip itself). The php file that contains that code should not output anything else.