Is it possible to version control a PHP + MySQL + Apache project? And could it keep track of the changes in the database, like for example if I added a new table, can I possibly commit that?
Thank you.
It is not normal to keep databases in version control. Some developers use a sqlite database for development so that it can be checked into version control, but this can lead to issues as sqlite syntax can be different from MySQL.
However, you can keep your database schema and migrations source control. Look at a projects such as mysql-php-migrations to get started.
There's a good tutorial on using PHP with Git at http://net.tutsplus.com/tutorials/other/easy-version-control-with-git/ - this should get you started.
Using Git for your PHP scripts is no problem, however tracking changes to the database is a little trickier. If you have SQL scripts that create the database structure then these can be version controlled with no problems. Otherwise you could use mysqldump to output the structure to an SQL script after any changes you make:
mysqldump -d -h localhost -u root -pmypassword mydatabase > dumpfile.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With