This article: HowToConfigureXDebug – NetBeans Wiki  is helpful, but you may need a bit of help to get over the top, so I have put a few hints in here in hopes to save others some hours I already spent.

I have now installed WAMP (Windows / Apache / MySql / PHP) and Netbeans several times dues to several laptop and hard drive failures, and kept getting stuck on this issue, forgetting the solution. The web pages I could find mostly show the correct information, however, some are old, and refer to old configurations, and none I found were completely correct.

I have found the fastest way to get up and running if you are going to program PHP under apache on Windows is to use the WAMP stack, which goes in smoothly.

Getting debug running is another story. Once you have installed WAMP, you need to do several things in order to get XDebug running. I am going to take you through the process (let me know if I have missed something – I am not an expert, just sharing scars so other can avoid!).

(This tutorial assumes that you have already downloaded WAMP from Bitnami’s site and run the install.)

1. Change the port to the one you wish to use. Quite often in a windows environment you will want to use a port other than 80 for PHP debugging (I am using localhost 80 for .Net and Visual Studio debugging). If you open the Apache configuration (which the Bitnami WAMP management program will open for you with a click):

Bitnami1

you will find the port in this configuration in two places – here:

ApacheConf1

and here:

ApacheConf2

2. You then need to edit the php.ini file (for me, located at C:\BitNami\wampstack-5.4.21-0\php) to include the xdebug dll – there are lots of places out there that tell you things like there being a php.ini in the bin folder (which there isn’t), and old versions of the editing that are required – these have been taken care of since then and changed.

One great thing about WAMP is that the correct xdebug file is already installed and ready to enable.

You will also find a great little tool out there that helps you determine if XDebug is properly installed. But you do not need it if you use Bitnami WAMP. Setting the config as follows below (you have to match your install – I used the default which I highly recommend). If you are using the version of WAMP I am using, you will find this code near the bottom of the file commented out (using semicolons) and need to uncomment it and correct the dll file reference. The dll should already be in there ready to go. The full path and forward slashes are required.

[XDebug]
;; Only Zend OR (!) XDebug
zend_extension="C:/BitNami/wampstack-5.4.21-0/php/ext/php_xdebug.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

This will then activate XDebug. There are other helpful settings in this file for development purposes (like logging and caching), which are outside of the scope of this post, but are easily Googled.

3. Restart the Apache server:

Bitnami3

4. Verify that your website works by navigating to:

http://localhost:8888

You should get the default index.html file’s output saying

It Works!

in large type. This means Apache is serving up an html file from the htdocs directory (C:\BitNami\wampstack-5.4.21-0\apache2\htdocs by default).

5. Now create and edit an index.php file in the same apache htdocs directory and type

phpinfo();

and then save it in that same directory.

4. When you now navigate to:

http://localhost:8888/index.php

The php engine will echo out it configuration info. XDebug should show up in the output in two places.

here (near the top):

phpinfo1

and here (near the bottom):

phpinfo2

I decided to post after the fourth time of getting stuck on this because the information is not all in one place and the most complete info is not current.

Happy PHPing!

 

My Jess’s senior dance. TAFA Graduation

My Jess’s senior dance. TAFA Graduation 2013 3 ‘Like An Avalanche’ – YouTube http://ow.ly/mF8gC Thanks for an awesome vid, Joey!

Selling my Harley Sportster 1200XL Custo

Selling my Harley Sportster 1200XL Custom ’97 low miles – Good Condition http://ow.ly/mtZsC Great reliable fun bike. http://ow.ly/i/2tCa5

#robbsadler loves #elmah http://ow.ly/kp

#robbsadler loves #elmah http://ow.ly/kpP9D Happy to find this. Make sure that you consider security: http://ow.ly/kpPow

Master Page DataBind() will clear data on your page – remember!

I was working on a problem with a drop down list getting un-initialized and had run across this page:

c# – .Net Webform losing data – Stack Overflow.

This simple post is about a coder who was getting their ddl control reset every time a postback occurred. They had not yet learned about putting the initialization inside an if statement that only runs when the page is first loaded.

I had done this, and had not changed the code on this page for days and yet it stopped working.

Then I realized — I had been fighting with the links on the site.master.cs page that were causing the link to come up blank. I learned that when you have a reference in your head element on the master page like so:

<script src='<%# Helper.ResolveMyUrl(“/Scripts/libs/jquery-1.7.1.min.js”) %>’ type=”text/javascript”></script>

You need this:

Page.DataBind(); // (yes, but not quite…)

in your Page_Load so that the function call will be resolved. I added that line and my links all started working — and my drop down list started clearing on a postback. But there were enough hours between these discoveries, that I hadn’t made the connection.

What I really needed was:

if (! Page.IsPostBack)  // (better, but not yet done…)
Page.DataBind();

since the DataBind affects all of the data bound controls on all of the pages that use it as a master page.

But wait, there’s more!

I thought this had cleared up my issue, but then I found that another control that I initialized lost its value. It turns out that this DataBind on the entire page is not a good idea. Instead you need to be specific about the stuff on the master page. So I did this:

if (! Page.IsPostBack)
{
  Page.Header.DataBind(); // initializes the script references
  LoginView1.DataBind(); // initializes a link inside LoginView1
}

Ok, I think that does it. I feel better about a more qualified / constrained approach too.

With this qualification, I got the initialization on the links I needed, and didn’t interfere with the drop down lists that were initialized once and then needed to remain populated. I didn’t find this anywhere, and so I am hoping that it will save someone the couple hours I spent.

Happy coding!

Sql Server remote connection troubleshooting

Resolving could not open a connection to SQL Server errors.

Really helpful link for troubleshooting through the issues for why you may not be able to connect to a Sql Server remotely. It steps through several possible issues. I had to google how to fix them, once I identified them, but this was a great help in discovering some of the issues.

For me, in short it was the following:

1. Make sure you have only one firewall running (I had Norton and Windows firewalls running).

Go to Windows Firewall settings and select “Advanced settings”

WindowsFirewall

Then ensure that all of the firewalls are set to off (WARNING: don’t turn off Windows firewalls unless you have another firewall running, and don’t configure firewalls unless you know what you are doing or you could lose data, your identity information, etc. If you have any doubts, get someone to help you!)

WindowsFirewallAdvancedSettings

This is how it will look after those second, redundant firewalls have been turned off.

2. Make sure the SQL Server services are enabled (SQL Server, SQL Server Browser minimally in order to see the Server on another box).

3. Enable the communication protocol that you are using (typically TCP or Named Pipes)

4. Allow port 1433 and possibly port 1434 through the firewall and limit the connection to your local subnet, or the IPs that will be connecting to the server.

5. This was the kicker for me – go into the configuration for the TCP and enable the ip addresses that you need. For me, since this server is behind a firewall, I allowed all connections.

Hope this saves someone the extra hours I spent finding out the final steps.

WIndows 8, VPN, Error 942

Windows 8 VPN error 942 « Codes from the field.

if You are having problem with Windows 8 and VPN, this may be the issue. The security protocol is not set at all!

Data Analytics

Changing Times for Data Professionals.

A good, short post on Data Analytics, and why we need to be paying more attention to them. In the end this is an invitation to the conference, but the post applies to all of us that work with data.

This was a weird issue that a coworker had that I thought I would re-post so others (and I) could find it easily when it comes up again. We were adding a report via the report wizard. Visual Studio (apparently) attempts to load the data sources you may have sitting in your Bin folder. If it cannot load one of those (for some reason), it will fail to bring up the report wizard (where you may be creating a new data source anyway).

ReportWizardError

The solution feels a lot like a hack (but this is Microsoft, right – comes with the territory).

Rename your Bin folder, then run your wizard, then rename it back.

Just wow.

I got this solution from here.

Connecting from Windows 8 to a Windows 7 share

This was driving me crazy. I would try several things that didn’t work, and after checking firewall stuff, and many other things — no luck.

Finally I stumbled on this info at :

http://www.neowin.net/forum/topic/1109019-so-windows-8-and-filesharing-does-it-even-work/

On the Win 8 box navigate to the following:
Control Panel\All Control Panel Items\Network and Sharing Center\Advanced sharing settings

Select ‘Use user accounts and passwords to connect to other computers’.

Then I logged into the PC at the computer name level and said save credentials. Ahh – I can finally update subversion from this laptop again!

Thanks SledgeNZ!

Update!

This broke again a week later. I found that somehow windows 7 had its firewall on at the same time. If you are running Norton 360, apparently in some cases, Windows will keep or turn back on its firewall. You should make sure that at your firewall settings:

WindowsFirewall

after selecting “Advanced Settings”:

WindowsFirewallAdvancedSettingsThat the firewall is turned off like shown above.

Disclaimer: Don’t mess with your firewall settings unless you are confident that you know what you are doing as you can lose data, and have your computer infested with viruses!

I am doing this based on input from Norton and have their firewall installed and active, thus a second firewall is both redundant, and can cause problems where you can’t connect when you should be able to.

The pertinent link is: http://community.norton.com/t5/Norton-Internet-Security-Norton/I-can-t-reach-computers-on-my-VISTA-network/m-p/381470/highlight/true#M144115

Follow

Get every new post delivered to your Inbox.

Join 465 other followers