This topic is locked
[SOLVED]

 Best Practices

10/31/2010 11:56:29 PM
PHPRunner General questions
O
ofi author

So far I've been testing various PHPR capabilities, but now I'm curious about properly setting up a project in order to have the least amount of headaches in the future.
I want to develop locally, then upload (or sync) to a Linux server. The files are uploaded via FTP (Publish via FTP). What about the MySQL database and its data? I'm unclear on the Connect to MySQL screen - can PHPR simultaneously connect to a local DB and a remote one?
How do I keep data synchronized and avoid overwriting newer data? Once the project goes live on the remote server, and various people add data to the remote database, how can I ensure that my local data (records) doesn't overwrite the remote data during a synchronization?
Thanks.

P
procheck 11/1/2010

Assuming that you're talking about one database and identical tables(some people connect to a 2nd database), you'll find your MySQL connect information in dbcommon.php. You will need to copy & keep a separate dbcommon and upload it to the internet. This one will have the information required to connect to your database on the net. You will find dbcommon.php in the include directory.
$host="localhost";

$user="userid";

$pwd="password";

$port="";

$sys_dbname="database name";
Once this is set up, then you will be ok.
Al

Admin 11/1/2010

Al,
in PHPRunner 5.3 you don't need to modify dbcommon.php manually. You can setup several connection settings on 'Output directory' screen.
Ofi,
PHPRunner doesn't synchronize tables and data. You can either develop your application connecting directly to remote server or use a third party software to synchronize local and remote databases.

P
procheck 11/1/2010

I hadn't notice the addition. Nice new feature.
Al

O
ofi author 11/1/2010



You can setup several connection settings on 'Output directory' screen.


Do I need to create two server database connections for my scenario where I have a local DB and a remote DB?

J
Jane 11/2/2010

No. You don't need to set up server database connections for local db.

Server database connections is used to point files on the web server to the database since connection details are different on your local machine and on the web server.

O
ofi author 11/3/2010

OK, it is still unclear to me how to work with two databases (one local and one remote) through PHPR.
If I develop locally, what should I do to synchronize the remote database to look like my local version?
I can see how it could be done via phpMyAdmin with export and import, but is PHPR capable of doing this instead?

Admin 11/3/2010

PHPRunner does not synchronize databases. There are excellent third party tools that can do the job. PHPRunner is about building the code.
Both Navicat and SQLYog can synchronize MySQL databases:

http://stackoverflow.com/questions/52583/best-tool-for-synchronizing-mysql-databases

O
ofi author 11/3/2010

So the procedure is to develop locally, upload the code with "Publish via FTP" and sync the database structure manually. Is that correct?

Admin 11/3/2010

It really depends on many factors. If you plan to modify database structure a lot - develop everything locally, test it, then upload everything to the server and synchronize databases. This approach makes sense if you already have a live application you cannot afford to break.
If you just starting you can connect directly to database on the server and make changes there. This going to save you synchronization step though it's going to be a bit slower (remote connection are always slower) and a bit riskier.
On the long run first approach is preferred.

O
ofi author 11/4/2010

Understood. Thanks for the advice.