ill some packages
aptitude install php4 postgresql libapache2-mod-auth-pgsql
php4-pgsql php4-cli
Make PHP File
vi runphp.php
Add this line to the first line
#!/usr/bin/php4
And make you own script with PHP Syntax. You can see my example file here (rename it from .txt to .php). This file doing this following actions:
* Connect to database (PostgreSQL).
* Get some data from database.
* Determine cost variable from that data with some function.
* Insert usefull new data into another table.
Make It Execuable
Make sure this php file can be execuate by:
chmod +x runphp.php
Get Error?
First time I run this file, I get this following error:
Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: ....
Don't worry, this error can be happen because by default PostgreSQL support for php4 in Debian is not enabled yet in the configuration for the Apache2 SAPI.
So type this command:
dpkg-reconfigure php4-pgsql
/etc/init.d/apache2 restart
That error should be fixed.
Run This File
Just type this command
./runphp.php
Well done and Good Luck
--
me, sUpricak3p
Articles Source - Free Articles