Debugging PHP Cloud application via SSH tunnel - php

I'm trying to use remote debugging in Eclipse/Windows via an SSH tunnel as described in these articles on PHP Cloud.
http://www.phpcloud.com/help/putty-ssh-debug-tunnel
http://www.phpcloud.com/help/debugging-overview
I've been able to establish an SSH connection using PuTTY with public/private key managed by Pagent. I'm now facing issues when testing the debugger in Eclipse's Debug Configurations menu. I've set up a server with the following details.
Base URL: http://lhith.my.phpcloud.com (the link to my application on
PHP Cloud).
Local web root: C:\Users\Luke\workspace\lhith (the path that contains
index.php on my local copy)
Path mapping: /.apps/http/__default__/0/1.7-zdc (the path containing
index.php on the server) -> /lhith (path containing index.php in the
workspace)
File: /lhith/index.php
URL: http://lhith.my.phpcloud.com
I also configured Zend Debugger to use port 10137 and the Client Host/IP of 127.0.0.1.
When I connect my SSH session and then try to test the debugger I see the error "A timeout occurred when the debug server attempted to connect to the following client hosts/IPs: -127.0.0.1"
What could be going wrong here? What can I do about it?
Thank you for any assistance provided.

I made some progress on this tonight. I setup port forwarding on my internet router to forward port 10137 to my computer and then added my internet routers public IP address to the list of allowed hosts on the Zend Server debug settings on my.phpcloud.com.
I also added this IP to the Debugger configuration in Eclipse and was able to successfully connect to the remote system. It appears there is a problem with the SSH remote tunnel settings, I will keep digging but I wanted to share my findings so far as this has been driving me crazy!

Related

Access to Rapla through Glype

There is a Rapla event planner running at my work. It is set to be accessible only from computers in our office, though (IP check?). I needed to have an access also from my home, but the administrator won't reconfigure Rapla. However, I have an sftp account at the server (which is the same as the one where Rapla is running - same IP addressess; this server is accessible from Internet at browser's port 80, since we have our homepage running there).
I figured out, that I can upload Glype proxy script to my acoount and run it like this from any IP address: www.mycompany-domain.com/myfolder/glype/index.php. It really works and redirects me to a lot of websites, while showing my company server's IP. However, when I try to connect to a 8051 port (Rapla's port) through Glype, I get the cURL error:
The requested resource could not be loaded. libcurl returned the
error: Failed to connect to /here goes the IP/: Permission denied
Later on, I found a script called Glypeahead, which, according to the author, should fix this issue. I wasn't able to find any info how to use it and being myself just an amateur programmer, I am stuck at this moment.
So, my question is the following: how can I connect, using Glype, to Rapla's port 8051? I am open to any non-Glype solution too :-).

External XAMPP Access With Modem

I'm trying to create a live web server on my Windows 8.1 computer.
I am connected directly to my modem using ethernet (I do have a wireless router) but I am not connected to it on this computer (desktop).
I have XAMPP working and my website appears at http://localhost/home
However, if I put in my IP from www.whatismyip.com it does not load my web server.
What am I missing?
You need to create a Port Forwarding for Port 80 to your Computers local IP Address. There should be a Admin Panel for your Router (normally the Gateway - check out with Start - Run - cmd -> then insert "ipconfig" and check out the Gateway.
And i guess in XAMPP the Internet Access is blocked. But this is a simple Apache Server, so you need to open your httpd.conf File (Should be: “c:\xampp\apache\conf\extra\httpd-xampp.conf)
Search here for:
There should be a "Deny from all" - add a # in Front to deactivate that rule.
Restart your Xampp and it should work.
Here you find more Information about Port-Forwarding:
https://managewp.com/how-to-access-a-local-website-from-internet-with-port-forwarding
Any maybe you will also need to activate Port 80 on your Firewall (depends on your Configuration)
You need a method of telling request sent to your public ip to be forwarded to the private ip of the web server. Try logging into you device (router etc) and setting this up.

PHP remote debugging: XDebug can't connect to JetBrains php Storm client

i's like to get remote debugging to work with the following software configuration:
Win 7 Pro 64bit
WAMP Server 2.2 (32bit) incl. Apache 2.2.22, PHP 5.4.3, XDebug php_xdebug-2.2.1-5.4-vc9.dll
JetBrains PHPStorm 4.0.3
1.) WAMP is up and running, my site can be found under localhost/fox/
2.) PHP Storm has a project where there is a mapping between my sourcefiles and the apache alias localhost/fox
2.) I installed the php extension XDebug and added the following lines to my php.ini
[xdebug]
zend_extension="c:/wamp/bin/php/php5.4.3/zend_ext/php_xdebug-2.2.1-5.4-vc9.dll"
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_connect_back=On
xdebug.remote_autostart=On
xdebug.profiler_enable=On
xdebug.profiler_enable_trigger=off
xdebug.profiler_output_name=cachegrind.out.%t.%p
xdebug.profiler_output_dir="c:/wamp/tmp"
xdebug.remote_log="C:/wamp/tmp/xdebug.log"
xdebug.remote_cookie_expire_time=6000
This should configure the Remote Debugging XDebug and the call back address.
I check already my installation here: xdebug.org/wizard.php
3.) I configured phpstorm, first i added the local server
and then checked my settings here
http://www.bilder-hochladen.net/files/jrn0-2-c81e-jpg-nb.html
( i tried 127.0.0.1/fox as Server address as well, and localhost instead)
hier my debug settings:
http://www.bilder-hochladen.net/files/jrn0-1-c4ca-jpg.html
Now i restart my apache, i go into phpstorm, set a break point (it is red), click the function
Run -> Start listen to PHP Debug Connections
The telephone receiver is turing into green, what ever that exactly could mean but it's a positiv signal to me.
When I now run my php Script on the local webserver absolutley nothing happens, the programm runs over the break point and does not stop.
In the Xdebuggers log (C:/wamp/tmp/xdebug.log) i find loads of these messages like these:
I: Checking remote connect back address.
I: Remote address found, connecting to ::1:9000.
E: Could not connect to client. :-(
Log closed at 2012-07-19 14:21:08
Somewhere in the internet i found the hint, that the windows firewall could block the communication so i turned it off completley but that did not help.
I also tried to connect via telnet to localhost:9000 and i got a response from phpstorm.
Has anybody an idea where to search the error or what else i could try to get this stuff working ?
Thank you very much for your help in advance,
Michael
p.s. Sorry i am not allowed to post more than two links because I am new here, so therefor no hyperlink to the xdebug wizard.
Maybe a bit late but...
Here you have a contradiction on your settings:
xdebug.remote_host="localhost"
xdebug.remote_connect_back=On
Those two settings overlap. What is your case?
a) You want to debug your application just from one single origin (for example, you are developing from and deploying to localhost).
Then you are almost done: you have already defined that the remote host is localhost. Comment out the remote_connect_back line (with ;)
b) You want to accept multiple development sources (for example, several machines debugging the application in the same network).
Then the remote_host line is being overriden, so you can remove or comment it.
This is effectively the configuration you are currently running. So, what's wrong with it? Check it out running this script:
<?
echo $_SERVER['REMOTE_ADDR'];
The output will be ::1. Well, the host which is making the request to your Apache server is localhost. And Apache is resolving that name as the IPv6 address ::1, which in the end is not wrong. But Xdebug is unable to connect to an IPv6 address. See:
I: Remote address found, connecting to ::1:9000.
E: Could not connect to client. :-(
So our goal will be to make Apache to resolve localhost preferably to an IPv4 address (without disabling any support for IPv6 at OS level nor at Apache level). This may be achieved by adding to your hosts file the next line:
127.0.0.1 localhost
This simple hack will do the trick! Now localhost will always preferably be resolved as an IPv4 address, while ::1 will still be perfectly understandable.
You can try to disable IPV6 http://support.microsoft.com/kb/929852, I think this is the problem, when you try to connect.
Remote address found, connecting to ::1:9000.
System are try to connect with IPV6 and I think that XDebug are only enable to IPV4.
Where exactly is your breakpoint in your code? I know that XDebug can be funny.
For PHP 5.4, your Xdebug settings should be
[XDebug]
zend_extension="<path to php_xdebug.dll>"
xdebug.remote_enable=1
xdebug.remote_port="<the port for XDebug to listen to>" (the default port is 9000)
xdebug.profiler_enable=1
xdebug.profiler_output_dir="<AMP home\tmp>"
http://www.jetbrains.com/phpstorm/webhelp/configuring-xdebug.html

PHP connect via SSH tunnel to LDAP in other network

I'm developing website for my school. In that school we authenticate users via LDAP, so there was an idea to do the same via school-site. On that site everything is working perfectly, but during developing I need very often to test if such solution works, of not. In order not to commit my changes so often I want to test this site on my local computer, but for connecting with LDAP i want to use ssh tunnel. In school network we have one server through witch we are connecting with inside of our school network. It's address is phoenix.lo5.bielsko.pl. Inside this network we have LDAP server with opened 389 and 636 ports. It's address is auth.lo5. I don't have access to auth.lo5 via SSH, I can only connect with it to get some LDAP entries. So, I've tried to run SSH tunnel by running:
ssh -L 636:auth.lo5:636 hfaua#phoenix.lo5.bielsko.pl
Then, I've set in my /etc/hosts that auth.lo5 is pointing to 127.0.0.1. I'm connecting to LDAP in PHP in such a way:
ldap_connect('ldaps://auth.lo5', 636);
But I'm getting error Can't contact LDAP server. I think, that problem might be on phoenix.lo5.bielsko.pl in its SSH daemon config or in arguments passed to ldap_connect() function. Can you tell me, what should I set in sshd_config or in arguments passed to ldap_connect to get it working?
I posted the same question in similar thread, but no one has answered my question.
P.S. In my /etc/ssh/sshd_config I have line AllowTcpForwarding yes
If I got it right phoenix.lo5 and auth.lo5 are 2 different machines.
If so you have to create a tunnel to the ssh machine, and then send the ldap queries to the right machine.
Your command: ssh -L 636:auth.lo5:636 hfaua#phoenix.lo5.bielsko.pl is right if phoenix.lo5.bielsko.pl can resolve auth.lo5 via DNS or /etc/hosts, if not you need to use its internal ip address.
Also if you want to use port 636 on your pc, you need to run your command as superuser (root or with sudo) else you need to use an high port (above 1024) as stated by Borealid
Once the tunnel is up you have to point to localhost to do the queries
I ran into this same issue. Running with -d1 showed me this error:
TLS: hostname (mylaptop.local) does not match common name in certificate (*.mydomain.com).
TLS reverse lookup of 'localhost' is 'mylaptop.local', checking if that matches the certificate common name
Could be you're hitting a similar problem.
I was able to fake it out by running:
sudo hostname someserver.mydomain.com
which caused SSL to assume it was talking to the right host.
I was also getting the error hostname (mylaptop.local) does not match common name in certificate (*.mydomain.com). However I did not want to edit the hostname of my machine to match that of the LDAP server. Instead I edited the hosts file (etc/hosts on linux) file to add a line that would intercept requests to the LDAP server eg:
127.0.0.1 ldap.server.com
This has the added benefit of not requiring you to change which server name you are trying to connect to in your code, you only need to change the port number if you chose a different port.
Try replacing all instances of auth.lo5 with localhost:
ssh -L 636:localhost:636 hfaua#phoenix.lo5.bielsko.pl
and
ldap_connect('ldaps://localhost', 636);
If that doesn't work, try turning off SSL to see if that works:
ssh -L 389:localhost:389 hfaua#phoenix.lo5.bielsko.pl
and
ldap_connect('localhost', 389);

Flash socket server only works on local machine

I have created a basic flash socket server in PHP, it all works fine on my local machine (both in the browser and in the flash sandbox) but as soon as I get another machine to connect to my computer's Site directory, they can't get a connection open to the server!
In flash:
mySocket.connect("localhost",9999);
In PHP
$address = '127.0.0.1';
$port = 9999;
I have tried changing the flash code to the IP of my machine but then none of the clients (including the local) can connect.
Please help!
PS. Running on a mac in the Sites dir.
I am running the socket server through
terminal (PHP 5). Am running a policy file server with perl but I don't think that is the problem
"127.0.0.1" is the address for the loopback interface. It's only available on the same machine. You need to listen on all interfaces (loopback, eth0, etc) by binding the socket to "0.0.0.0".

Categories