/    Sign up×
Community /Pin to ProfileBookmark

debugging PHP

I am doing some stuff for my boss using PHP and I am having a little bit of trouble because when I upload something to the server with something wrong it just goes white. I was wondering if there is a way to step through the php so that I can work on this. Our site is hosted at IPOWER so I do not have a WebServer on Site. If I can get this to work I will absolutely love PHP until then I hate it because everything keeps dying…

Thanks a lot!

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 13.2010 — You can download and install Wampserver (windows) or XAMPP (most platforms) to install PHP, Apache, and MySQL on your PC so that you can test locally. For testing you can then turn on display_errors in your php.ini file so that all errors (including parse errors) are displayed. (You'll probably also want to set error_reporting to E_ALL.)

Additionally, if you use any of the several available text editors or IDE's which include built-in PHP syntax checking, you can avoid a lot of simple errors before ever trying to run your script. (Komodo Edit, NetBeans, Notepad++, etc.)
Copy linkTweet thisAlerts:
@Xtrme_XJauthorJan 13.2010 — Awesome Thanks! Hopefully I will be able to install Wampserver successfully. I use Notepad++ it is the most amazing program ever! Thanks a lot again
Copy linkTweet thisAlerts:
@NogDogJan 13.2010 — Awesome Thanks! Hopefully I will be able to install Wampserver successfully. I use Notepad++ it is the most amazing program ever! Thanks a lot again[/QUOTE]

After installing Wampserver, you can use [url=http://www.wampserver.com/en/add-ons.php]this page[/url] to download and install specific versions of PHP, MySQL, etc. to best match what is on your production server. (You can actually install multiple versions, then select which ones you want to use at any given time.)
Copy linkTweet thisAlerts:
@Xtrme_XJauthorJan 13.2010 — So I installed Komodo and Wampserver and I am debugging PHP!!! When i get to any sql stuff it ends. Is there a way to connect with the db using this stuff?
Copy linkTweet thisAlerts:
@skywalker2208Jan 13.2010 — So I installed Komodo and Wampserver and I am debugging PHP!!! When i get to any sql stuff it ends. Is there a way to connect with the db using this stuff?[/QUOTE]

You will most likely need a copy of the database that you have on your live server and import it into your local machine. You will also have to set up the database with the same username and password that you use on your live server.
Copy linkTweet thisAlerts:
@Xtrme_XJauthorJan 13.2010 — I just got a copy and put it on my local host do you know how I get Komodo (or any other editor where I can step through code) to recognize the server and run the sql statements?
Copy linkTweet thisAlerts:
@NogDogJan 13.2010 — I usually use phpMyAdmin (which is included with Wampserver and XAMPP) if I want to test queries directly with the DB (rather than through my PHP code.)
Copy linkTweet thisAlerts:
@Xtrme_XJauthorJan 13.2010 — I am not trying to test my queries. What i am trying to test is what my code does after I get the information from server.
Copy linkTweet thisAlerts:
@MindzaiJan 14.2010 — The only way to do that is to run your code with any debugging statements you might need. Take a look in the PHP manual at var_dump and print_r, they are usually the debugging workhorse functions. You can then point your browser to the script on your server and examine the output.
×

Success!

Help @Xtrme_XJ spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...