In Studio, trying to debug against an IBM i remote server, when the Debug button is clicked, the script runs and displays in the browser, but does not stop at any breakpoints.
This article was written for Zend Studio 13.5 and Zend Server for IBM i version 9.1.
Note. Zend Studio 13.6. was the last version and is no longer supported.
If the script runs in Studio but does not break at any break points, this is usually due either to not having a valid Allowed host entry in the Zend Server UI to allow debug from the IP address of your desktop, or not having your correct Client IP(s)/Host specified in the debug settings in Studio to match the IP address that is stamped on the http request.
To check all of this, you need to be aware of your desktop ip address, which you can see by running ipconfig in a windows command box (if you have windows). You may notice you have multiple IP addresses if, for example you are attached locally to a router and to the office via a VPN. You need to use the IP address the IBM i sees, so if you are attached to a VPN into the office, that is usually the one to use. We do sometimes see NAT or other translations happening, so after you make the debug request, the surest way to know the IP stamped on the request is to look at the Apache access log and find your request in there. That will be the IP address Zend Server is expecting you to have entered in your Studio Client IP(s)/Host setting.
The first thing is to make sure your IP address is listed as an Allowed host in Zend Server. This can seem confusing, because we tend to think of the PC as the client, but in this context it is the host. You will need access to the Zend Server User Interface, which developers sometimes do not have. If you don't have access, you will need to work with an admin on this step.
In the Zend Server UI, please go to the Debugging -> Debugger tab. Make sure Zend Debugger is selected as the preferred debugger. In the Security settings, you can see a widget to enter the Allowed Hosts, and some buttons that indicate Allowed Hosts that have been entered. You can look at the text on the buttons to see if your PC IP address is an allowed host.
The allowed hosts have a bit mask to provide a matching pattern. An 8 bit mask means your IP only has to match the first group of three digits to be allowed. A 16 bit mask means the first two groups of three digits must match, a 24 bit mask means the first three groups must match, and a 32 bit mask means it must be an exact match.
For example, if your IP address is 10.1.15.23, here are some examples of what does and does not match:
10.0.0.0/8 (anything that starts with 10) - matches
192.0.0.0/8 (anything that starts with 192) - does not match
10.1.0.0/16 (anything that starts with 10.1) - matches
10.3.0.0/16 (anything that starts with 10.3) - does not match
10.1.15.0/24 (anything that starts with 10.1.15) - matches
10.3.15.0/24 (anything that starts with 10.3.15) - does not match
10.1.23.0/24 (anything that starts with 10.1.23) - does not match
10.1.15.23/32 (exactly 10.1.15.23) - matches
10.1.23.15/32 (exactly 10.1.23.15) - does not match
Please look at the buttons under Allowed hosts. If your IP matches any of the patterns, you are allowed to debug. Also look at the buttons under Denied hosts. If your IP address matches any of these patterns, you will not be allowed to debug. If you are not allowed, or if you are denied, please work with an admin to get your IP address allowed, using the input form for Allowed hosts there in the Debugger menu. The pattern will depend on how the subnets are defined at your company, so your network administrator will need to provide the correct pattern.
Step 2 - Verify your Client IP(s)/Host setting in Studio matches your actual IP address
In Zend Studio you can specify the Client IP(s)/Host at the Global and Server level. You need to set the Server value for the Client IP(s)/Host to use with remote debugging on the IBM i. You can then verify the correct server is used for your Workspace or Project.
Check the global value for Client IP(s)/Host
In Studio please go to Window -> Preferences -> PHP -> Debug -> Debuggers -> Zend Debugger. This should bring you to the Zend Debugger Configuration dialogue. The first setting is the Client IP(s)/Host directive, with an option to use Auto or Manual. This can be a column separated list of IP addresses. If you do not see your correct IP address on this list, please select the Manual option. You can now set the value for this directive using the Configure... button. When you click Configure..., you will see a table of IP addresses. One of these should be your correct IP address. Please select it, and deselect any other addresses you may see there. Click OK to save the change.
Check the Server value for Client IP(s)/Host
In Studio please go to Window -> Preferences -> PHP ->Servers. This should bring up the Servers dialogue. Select the IBM i server you want to debug from the list. If your server is not yet defined in Studio, then you need to set it up. This can be done from this dialog using the New button. Now, click on your IBM i Server to highlight it. Click on the Edit button. This brings up the PHP Server dialogue. Please go to the Debugger tab. Under Connection settings, you will see the Client IP(s)/Host directive. You can set the value for this directive using the Configure... button. When you click Configure..., you will see a table of IP addresses. One of these should be your correct IP address. Please select it, and deselect any other addresses you may see there. Click OK to save the change. Back on the Debugger tab, there is a button that will allow you to test the debug connection. Click that button to test your connection. You will either have success, or a message will appear telling why not.
Step 3 - Verify you are using the correct server for your Workspace or Project
If you are not using a Project
Please check the Workspace value for the Server to debug against. In Studio, please go to Window -> Preferences -> PHP Debug. Under Server Settings, look at the PHP Server drop down button. This should show the IP address of the IBM i server you want to debug against. If not, select the Server from the list under the drop down button. If it is not there, click the "PHP Servers..." link next to the button to bring up the dialogue for Servers, and you can create a new one. See the above section on how to set and test the Client IP(s)/Host for the Server from this dialogue.
If you are using a Project
Please check the Project value for the Server to debug against. In Studio please find your Project in the PHP Explorer perspective and right click it. Select Properties from the context menu. In the Properties dialog, go to PHP -> Debug. If "Enable project specific settings" is checked, continue on this PHP Debug dialogue. If it is not checked, either check it, or use the link to "Configure Workspace Settings". On whichever PHP Debug dialog you choose (Project or Workspace), look at the PHP Server drop down button. This should show the IP address of the IBM i server you want to debug against. If not, select the Server from the list under the drop down button. If it is not there, click the "PHP Servers..." link next to the button to bring up the dialogue for Servers, and you can create a new one. See the above section on how to set and test the Client IP(s)/Host for the Server from this dialogue.
At this point you should have a valid Allowed Hosts entry defined in your Zend Server UI, the correct Client IP(s)/Host address set up in studio for the Server you want to debug against, and the correct Server selected for your Workspace or Project. You should be able to test the connection and either make the connection successfully, or see a message with some more information about why the connection has failed.