Jump to content
xisto Community
Xenon

How do you test your php code

Recommended Posts

i have just installed apache msql and php. so i test eerything locally . i mostly use it to test the word press themes. so i have also installed wordpress

Share this post


Link to post
Share on other sites

I am usually testing my scripts locally, thus elimitating the need to upload the files every time I update them (and the time to reload the page is obviously smaller).

I've just installed XAMPP, a package containing Apache (with some extra mods), PHP (and several addons and Pear scripts), MySQL, phpMyAdmin and a few other useful scripts. I've tried other Apache+PHP+MySQL packages, including WAMP (posted by OneMinute) and Apache2Triad, but XAMPP is by far the best and most reliable one. On the other hand, it's not recommended if you want to run a public server, but it's awesome if you're only going to use it to test your scripts.

Share this post


Link to post
Share on other sites

I generally test scripts locally, but I use linux, so it's easy to do that. A few years ago, when I was still using windows I used something like http://www.wampserver.com/ to setup a server and again tested locally. For basic scripts there's unlikely to be any issues with then uploading to your web-host. However, if you get more complex, for example sending mail or the like, then you may need to match your settings locally.
I suspect the main issue is to make sure you work with globals OFF.

Share this post


Link to post
Share on other sites

I test my php files locally. But I have a diffrent setup. I am using microsoft virtual pc and have windows server 2003 installed + IIS6 + php. Then I have the web folder shared over the network and I map the folder to my computer ( A:\ for example). I just open the files directly from A:\ into dreamweaver and edit them and save them. no uploading necessary. And when I don't need the testing server, I just close it and Virtual pc has a feature called save state, and it saves the state of the server sp next time I open it it continue where it stoped from, kinda like hibernate. That way I don't use up system resources.

Share this post


Link to post
Share on other sites

I test my scripts at my pc. It's easier if you want to make a lot of changes in the script. But from the topic i thought you wanted to know how to test variables, lol.The answer to test variables is echo them. (for me at least)Greetz~Jo?o Lopes

Share this post


Link to post
Share on other sites

There are many ways to do this, i personally just have my notepad connected to my FTP directly, so once i hit save it is updated on the server. I have also built a small app a few years back i call HTTPEdit. It is a browser based editor so you dont have to keep uploading the file, you just submit and view through your browser.

 

other options

Install PHP locally on your computer - may have difficulties depending on if your computer savvy

Use an auto-updater like my notepad, there is one in Macromedia Dreamweaver if I'm correct.

Use a program like XAMPP to emulate php and mysql on your computer

Use a web based editor like mine :P

Last but not least, Classical FTP to Server :P

 

 

there are probably many more ways, those are the most common.

good luck!

Share this post


Link to post
Share on other sites

The easiest way to do this is definitely installing XAMPP, run the services and there you go, put the files in the appropriate folder and you can view PHP pages instantly on your local machine. The other way I would go around previewing my code is to upload it directly on my host, but then again it isn't very bandwidth friendly with the number of times you are going to preview the page.

Share this post


Link to post
Share on other sites

The easist way is to create a folder on your site called PHP or something, then make a quick javascript page in there, so you can type the filename, and it will bring you to the page you typed the name of. But if you want to test offline. You need an environment... I know that there is something included in windows XP for that, which supports PHP and ASP ect...sorry i cant be more specific...

Share this post


Link to post
Share on other sites

While I was using Wintendo, I used to run PHPTriad, then switched to XAMPP... They are the best and the easiest solution for web developers...Now, I run a linux box, I always have the latest stable version of Apache, MySQL, and PHP... Plus a ton of extras, since I have my own server at home ;) SSH, ftpd, and such... And it all works out of the box...Uploading to a remote server isn't very productive, since it takes time to upload all you need up, then preview... You can loose upto half a minute each time... And when added together, it can become a big time amount, like half an hour lost, or so...

Share this post


Link to post
Share on other sites

I always test them onlineusually call it test.php, upload it, and upload all includes it needs, and connect page.sometimes I code a log in itSo I connect it, and if it do its thing, then im happy, and continue coding the scriptI dont test it local, because some things locally dont work on other servers, thats why ;)- optiplex

Edited by optiplex (see edit history)

Share this post


Link to post
Share on other sites

I usually use both my local server as well as my webhosting account. This is because my server has different configurations and some scripts might work differently.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.