From quanta Sun Jul 06 11:47:37 2008 From: Neill Jones Date: Sun, 06 Jul 2008 11:47:37 +0000 To: quanta Subject: Re: [Quanta] PHP Message-Id: <4870B0D9.3000105 () yahoo ! co ! uk> X-MARC-Message: https://marc.info/?l=quanta&m=121534491202416 Apologies that this post has now drifted away from Quanta - but just to add a few points on this post ... > I have setup both Apache and PHP without any problems on my Kubuntu > machine and my little 386 Debian server. One of the two main problems I > have is with the MySQL. It is a pain and a considerable amount of work > to set it up and to make sure all the databases and user names are the > same as my website. If I was writing a PHP/html site without MySQL I > would use a local test machine for sure. Unless you know an easy way to > get all my tables and users over to my local machine > MySQL has quite a few methods for backing up a database, which you would want to be doing anyway and you could download a backup to get a version over. Otherwise you just need the structure of the databases, and some test version of data on your local machine. MySQL can help you with all of that - their documentation is pretty extensive on this. For example on mine, I have a million users which I added through a test PHP script, so I can see how the site will behave under load. I have written a bash script which will output the structure of the database which I send to the server, plus marked which tables must be kept in sync in terms of data, and those I copy the data across too using other scripts. It might be a bit of a pain to set up in the beginning, but the effort to understand how to do it will repay itself many times over. For example, it took me a couple of hours to write the scripts, but now keeping the system in sync takes one command line call, and enough time to make a cup of tea. The best bit (especially if you don't like tea) is I don't need to think about it each time, and can be pretty certain the process has worked correctly. > The second problem I have is that even if something worked on my local > test machine that does not necessarily mean that it will work on the web > server. > This is true - however you should not test out new code on your live server. If you are renting the entire server or know the exact layout of the server in terms of Apache, PHP and MySQL config files, you could use Virtual Box to make a test version of your server locally. Then the process is simply 1) code local 2) Transfer to test version of server and test out 3) If successful use same method and code to transfer to live server. Otherwise remove from 2 and go back to 1 If you can make sure the configuration and versions of software are identical on the Virtual Box version and the live version and you will minimise problems (you might still hit some, but these will be much rarer). Couple this with some test programs that you write which will give you confidence that the machines are functioning properly, and you can now upgrade the server with relative safety. > When my site goes "in service" I will seriously think about using your > advice because at that point it would be nice to make sure something > works before putting it online. At the moment I am just developing the > game and it is not in use, so I can play with it as much as possible > without bugging anyone :). > Very true, but I would say the earlier you do it the better it will be for you as you will be more practised at it before you need to do it for real. The amount of effort is about the same, but you are doing it at a safer point in the project when, as you say, you wont bug anyone. > You can take a look at my site if you like at > http://engarde.elementfx.com. It looks very bland at the moment because > I decided to do the html and css at the end. > On a minor point and away from Quanta and PHP I use Smarty for the html pages. I would highly recommend it (although I know some others don't like it). Makes for a very clean front end in terms of code. Regards Neill _______________________________________________ Quanta mailing list Quanta@mail.kde.org https://mail.kde.org/mailman/listinfo/quanta