This topic is locked
[SOLVED]

  Edit a project's connection string? [Production vs. local projects]

1/3/2012 9:43:35 AM
PHPRunner General questions
mcebula author

Hi, have a PHPR project called BDRLOCAL.phpr which is mapped to a local Oracle database called BDRLOCAL.
Now I'm trying to create a separate mirror project that runs off a production copy of the database called BDR running on a remote server. Right now both database structures are exactly the same (local and production). It's a very primative attempt at source management, keeping 2 separate PHPR projects pointed to 2 separate database structures so I can do maintenance locally without touching production. I understand I'll have to duplicate changes in the production project when the time comes to deploy a new version.
I went into phpr project BDRLOCAL and did a project "save project as" and called new project BDR.phpr. The database that the new project points to appears to be the local BDRLOCAL db. Is there any way to edit what database conntection string a project uses?
Is there an easier way to acheive what I'm trying to do? Do I just keep the 1 version and change it's output database connection and folder location when I build the project?

Admin 1/3/2012

In PHPRunner 5.3 and 6.0 you can proceed to 'Output diretory' screen and create a new server database connection that points to another database. No need to keep to different projects.
More info:

http://xlinesoft.com/phprunner/docs/output_directory_settings.htm

C
cgphp 1/3/2012

In the AfterAppInit event the database connection is not yet open. In this event you can override db settings:

define('ENVIRONMENT', 'DEVELOPMENT');
if(constant('ENVIRONMENT') == 'DEVELOPMENT')

{

$host="localhost";

$user="root";

$pwd="root";

$port="3306";

$sys_dbname="db_name";

}

else

{

$host="remote_host";

$user="root";

$pwd="root";

$port="3306";

$sys_dbname="db_name";

}


Now you have only one project and you can easily work on two databases.

mcebula author 1/3/2012

Thanks, the output page option sounds good. I'll just toggle 2 output folders and db connections on the output page. I just got my production database so I'm getting close to deploying my app so I guess I'm too excited to think straight <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=63397&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />