TheNickmaster21
TheNickmaster21

Reputation: 275

Testing PHP Locally With External Databases

I am new to PHP and I am developing for my website. I will have MySQL to run the databases server side and I would like to test my PHP code locally. Is it possible or would it just be easier to upload all of the code and test it from the website?

Upvotes: 0

Views: 211

Answers (4)

Mike Brant
Mike Brant

Reputation: 71384

I like to test in as close to the final production environment as possible, so if you are running on different OS local vs. production, I would like to test on a server like the production server.

There is no reason that you couldn't use remote MySQL servers so long as your local environment can access the remote MySQL servers. This might be undesirable from a security standpoint.

You could also run MySQL locally if desired (there are installers for any major OS out there).

Upvotes: 0

Chris Laplante
Chris Laplante

Reputation: 29658

Check out WampServer. It's a quick way to set up a local testing environment with everything you need: PHP, Apache (the web server), MySQL, and other useful tools (phpMyAdmin, etc.)

I've used Zend Server Community Edition as well, but I like WampServer better.

Upvotes: 0

slugonamission
slugonamission

Reputation: 9642

It is possible, but your MySQL users must have permission to log in remotely (i.e. are user@'%' style entries), and the server must be externally accessible through any routing and firewalls. For most online installs, this is quite unlikely since it poses a potential security issue.

As in the comments, just install MySQL locally to test with.

Upvotes: 1

Peter Parker
Peter Parker

Reputation: 29715

You should be able to test locally without anything else than your own machine

IF you need a database for it you should install one locally. If size matters just use a stripped down variant of your database (so called developer database).

Upvotes: 0

Related Questions