Synchronize Custom FTP Accounts :: API Help

I'm writing an API for the OGP (Open Game Panel www.opengamepanel.org) control panel to create custom FTP users with non-standard homes.

After creating, deleting, and modifying the correct database values, I run a script called syncftp.php which contains the following:


<?php

require ("/var/www/new/ehcp/classapp.php");
$app = new Application();
$app->connectTodb(); # fill config.php with db user/pass for things to work..

$app->addDaemonOp('syncftp', '', '', '', 'sync ftp for nonstandard homes');

?>

When I run this script from the command line terminal (using php-cgi -f syncftp.php), I receive the following error:

Notice: date_default_timezone_set(): Timezone ID 'Europa/Istanbul' is invalid in /var/www/new/ehcp/classapp.php on line 194

Warning: mysql_connect(): Access denied for user 'earnolmartin'@'localhost' (using password: YES) in /var/www/new/ehcp/config/adodb/drivers/adodb-mysql.inc.php on line 365

Any idea why this is happening? Is this the correct way to call EHCP to sync the non-standard homes?

Please let me know.
~
Thanks!

the first is not an error, it is a notice, just ignore it. it causes no problem.

the second one means your db user is wrong. check your config.php in ehcp dir, and fill it with right user values for mysql.
your mysql user is earnolmartin, but it cannot connect using that. you may need to reset your mysql pass for this user.

to debug, just use commandline mysql:
mysql -u earnolmartin
then, enter your pass, that is seen in config.php
if this does not work, then, your script will not work...

actually, you dont need to use php-cgi,
just use php as calling program.

For anyone working on an API for EHCP, your PHP script should chdir into the EHCP directory first before intializing the app class. This ensures the config.php is successfully included within the app class. You will need this for any database changes.

Here's a sample:

$curDir = getcwd();

if(chdir("/var/www/new/ehcp/")){
require ("classapp.php");

$app = new Application();
$app->connectTodb(); # fill config.php with db user/pass for things to work..

$app->addDaemonOp('syncftp', '', '', '', 'sync ftp for nonstandard homes');
}

chdir($curDir);

Hope this helps!

~
Thanks
OwN-3m-All
EHCP Force Edition