Determining correct PEAR data dir

From: Date: Tue, 14 Sep 2004 05:34:27 +0000
Subject: Determining correct PEAR data dir
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33370@lists.php.net to get a copy of this message
I'm working on an application for a client that I'd like him to be able to install/upgrade with the PEAR installer. I'm also working on a PEAR package that requires database storage, and will need to load a schema file. So, this question is both PEAR and PEAR-DEV related, I guess. The application is still in the design phase, and I would like to be able to have this kind of functionality: <?php $options = array( 'dsn' = 'mysql://user:pass@localhost/app_db', 'config_dir' = '/path/to/writable/dir' ); $app = new Custom_App($options); if (!$app->installed()) { $app->setup(); } else { $app->doYourThing(); } ?> The Custom_App::installed() method would check some file containing internal data in the config_dir to determine if the application had been installed. If it has not been, the Custom_App::setup() method would perform all necessary setup operations, including: - Create database if it does not exist - Import schema into database if it does not exist The question I'm having is -- how do you best determine where the PEAR_DATA_DIR is located? I need that in order to be able to load up the application schema file. I've looked at the constants that are set when PEAR.php is included, and while PEAR_INSTALL_DIR is set, it doesn't always seem to display the correct path. For example, in my test setup, PEAR_INSTALL_DIR shows '/usr/lib/php'. However, I have a second PEAR install that is essentially a "local" install in '/path/to/stuff/pear' as described in the PEAR manual. When I set my include path to ONLY look in the local PEAR install of '/path/to/stuff/pear', the value of PEAR_INSTALL_DIR does not change. I've tried experiments with PEAR_Info for getting the value of PEAR_INSTALL_DIR relative to the PEAR install directory I'm working with, but the results are the same: data_dir still claims to be in /usr/lib/php/data instead of /path/to/stuff/pear/data. Is this a bug? Or am I not looking in the right spot? Thanks in advance, -Clay -- Killersoft.com

« previous php.pear.dev (#33370) next »