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".
Related
I'm printing successfully in a local dev enviorement, running my web server on the same lan where I have the brother label printer. This is the code:
use Talal\LabelPrinter\Printer;
use Talal\LabelPrinter\Mode\Template;
use Talal\LabelPrinter\Command;
$stream = stream_socket_client('tcp://192.168.1.76:9100', $errorNumber, $errorString);
$printer = new Printer(new Template(1, $stream));
$printer->addCommand(new Command\ObjectCommand('referencebarcode', $product->reference ));
$printer->printLabel();
Work fine, but when I try on the production server, changing local ip 192.168.1.76 to public ip brother installed lan, and port 9100 forwarding to local brother IP. It's not working.
My server are running on docker container, across a nginx inverse proxy.
Can I do that? There is another way to do this? Print barcodes on my Wifi Brother, from my app running on server deployed on the internet?
Thanks a lot
Usually I use the method of this post to connect my mobile devices to my local dev server but I changed flats and it doesn't seem to work anymore. I seem to be doing everything right:
run server:
php artisan serve --host 0.0.0.0
check server ip (mac):
ipconfig getifaddr en0
browse ip + port on mobile device:
https://192.168.179.125:8000
Iphone shows:
This site can't be reached
Am I missing permissions or something?
I work with 2 servers one is my production server other is my resource server.
I cannot connect to my resource server from my production server over ftp.
I can connect to other servers from my production server.
I can also connect to my resource server from my localhost or filezilla.
I use this code to connect :
$conn_id = ftp_connect("resource server ip", "21", "5");
if ($conn_id) {
echo "connected";
ftp_close($conn_id);
}
print_r(error_get_last());
I don't get any output when I run this script on server(no error).
On localhost it runs no problem.
What can be the problem with this? Is this something that server admin has to resolve? Thanks for help.
You should first check from commandline, whether it's a networking/OS issue or not.
So if you've got shell access to the production server try connecting to the resource server via the commandline ftp client.
If that does not work, you've got a network / firewall / access control problem, not related to php or your software, and you should talk to the sysadmin.
If it does work, then the problem is in your stuff, and you should set the log levels to high, and run this script from commandline, also check the logs of php, php-error, syslog and the resource servers ftp access log and syslog too.
Note: ftp is a not-too-exact beast, the servers and clients have a lot of workarounds built in to treat each other in a way, that works somehow. There could be issues from active (multiple back-and-forth connections) and passive mode (it's like http), also with ls formats and timestamps, timezones and ports.
Also some servers only support ftps (ftp with ssl) - which is not the same as sftp (file transfer over ssh - port 22).
Your production server probably has some firewall rules, and your connection get caught on that, to debug this, please use the commandline ftp client, and/or nmap / netcat.
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!
website A: hosted on some free web host.
website B: my server
I want to connect from website B-(client) to mysql server of website A-(my server).
I've granted remote permission on mysql user with %.
But connection doesn't work. I've tried to run php script (mysql_connect) on different free web hosts.
000webhost.com : Can't connect to MySQL server on 'My SERVER IP' (4)
biz.nf : Lost connection to MySQL server during query
same script different mysql errors.
this php script run smoothly on my online SERVER, and also on localhost setup (connecting remotely to SERVER).
Is something else I've to configure on my SERVER?
I know that free web hosts doesn't allow remote mysql connection but in my situation I'm trying to connect with my own mysql server.
Does "remote mysql access" means both in and out connetion?
I've search a lot, something to do with ip-binding or port? I dont know where is actual problem?
Kindly help me out.
Tell mysql that it should listen on a fixed IP address, not 127.0.0.1 or localhost.
open file /etc/mysql/my.cnf (or /etc/my.cnf):
before
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
after
# INSERT YOUR IP Address here
bind-address = 192.168.45.1
#bind-address=127.0.0.1
Then restart your mysql server. HTH
Does your remote website's firewall allow external connections to the MySQL Port 3306?
Find this out to make sure you aren't spinning your tires