I am newer than a newbie to php. My question is, if a hosting company includes my PHP and my SQL, should I download these programs to my personal computer, or use them through the hosting company. Also, if I should ever change hosting companies, could these files (any database info) be transferred to new hosting company?
Thanks so much,
05-09-2008, 03:48 AM
When learning php, developing php code, or debugging php code, it is always best to do this on a local development computer. The learning/development/debugging cycle will occur faster.
You will also be in control of the php.ini settings so you can set the error_reporting level to E_ALL (and include E_STRICT if you are interested in writing code that is not dependent on old depreciated functions) and set display_errors on so that php will help you by telling you what it finds that is not correct.
A lot of code in the learning/development/debugging stage contains security problems. By not doing this on a live server, you don't open the possibility of a hacker taking over.
Then, only after your code is tested and working, put it on a live server.
Any of your files or databases on a hosting server can be backed-up/copied and moved.
Thanks so much CFMaBiSmAd. This has been helpful (as simple as it may seem to you). Would you (or anyone) suggest using a local computer to create database using my SQL or setting it up through my hosting company?
05-09-2008, 04:31 AM
For development purposes, setup mysql on your local computer as well.
There are several all-in-one Apache/php/mysql packages. The most up to date is XAMPP - http://www.apachefriends.org/en/index.html
If you intend to use MySQL on the web host (and I'm sure you do), you'll still need to setup the database on the host regardless of whether you do so on a local machine. I recommend getting the database structure and queries down first with some sample data, then transfer the empty structure to the host. It is also rather important that you understand SQL (http://www.google.com/search?&q=SQL%20tutorial) and the relational model (http://en.wikipedia.org/wiki/Relational_model) before you venture to add any queries to your PHP code. The MySQL manual (http://dev.mysql.com/doc/refman/5.0/en/index.html) is invaluable and there is a relatively good tutorial (http://dev.mysql.com/doc/refman/5.0/en/tutorial.html).
While we're on the subject, the PHP manual (http://www.php.net/manual/en) is also the best reference you'll find.
Something that wasn't mentioned but is very important; make sure you match versions and configurations as closely as possible between your local machine and the host server. You don't want to have an entire application built around the latest bleeding edge versions of PHP & MySQL (and Apache, if applicable) and find out afterwards that your host is still using older versions.
If possible, sign up with a host that does have PHP 5 and MySQL 5, the most current versions; you'll find you have much more flexibility with these versions and eventually be able to do more.
Like to thank everyone who tried to help me. I've been working on this Apache/php/mysql ALL DAY! I've tried to download them individually, I've tried the 'Apache Friends' all in one download. I keep getting a message something about the TCI/IP port 80 thing. Have no idea what I'm doing. Thought it could be done, but I guess I'm an *****. I'm exhausted :(
05-11-2008, 07:43 AM
The port error occurs if you have a program running on that port. Usually instant messagers like Skype and Yahoo take up these ports. Its also possible that your previous installations didn't remove apache and it may still be running.
05-11-2008, 10:29 PM
It is good to do the development and testing on a local setup before uploading, as the process is faster and more secure,
One of the all-in-one packages is useful for getting up and running quickly, but I think it is better to install and configure the components (Apache, PHP, MSQL, etc) one by one, since you learn more that way. I've used this tutorial (http://www.ricocheting.com/server/) as a reference whenever doing this on a new PC - it is fairly current and very helpful.
For the port issue, this can happen if you have IIS or some other programs installed, as mentioned. After installing Apache, you cold try changing its port number to something other than the default 80, so as to remove the conflict.