Seleiumn With Gcloud - php

We have Google Cloud Server and set up Selenium Grid on it. Selenium Grid hub is up and running.
But when I want to reach ip::4444/grid/console/ from my PC browser, I cannot
reach it.
I also cannot test from my PC; I do everything as Node in My PC.
When I go to the Google cloud Server (The Test Inteface) and enter Start Test, the test does not start. I get this message: " Error forwarding the new session Empty pool of VM for setup Capabilities "
I use PHP (Facebook Webdriver).

There are two level of firewalls, one is Gcloud. Next is your machine
Gcloud firewall needs to allow 4444. Then you need to check firewall of machine using iptables -S
If you see the port is not allowed, you can use below iptables statement to add it
iptables -A INPUT -p tcp -m multiport --dports 4444 -j ACCEPT

Related

Updating PHP file to server not reflecting its functionality in app

I am an iOS developer and also have some experience in PHP development as well. I got a project from other developer in which we have chat module that uses Socket programing with Ratchet(http://socketo.me/) for chatting purpose. We are using AWS Ubuntu instance for the backend.
When i execute this command "ps aux | grep php" on server than I can see a chat server php file that we are using for chatting purpose on a specific port number that port number we are also using in app for communication.
I want to add some more functionality so the main issue is that when I make any change in that chat server file and upload it to server in the same directory which is indicting in this command "ps aux | grep php", its not reflecting the changes in app while file is uploaded successfully. I also tried to restart server using "sudo service httpd restart" but didn't get any success.
Any suggestion would be highly appreciated.
Your chat is probably running with a command like:
php bin/chat-server.php
So restarting httpd won't help.
You should restart the service that runs the actual chat server.

Can we run node and apache both on same port

I have a application in nodejs and PHP. For now i am using different both.
Can i run node and apache both on same port 8080
Is, there is any way to run any application both on 8080
Thanks
An port is usually connected only to one application. So you have to use different ports.
Proxy -
But you could for example create an virtual host in apache and configure this host as proxy. In this configuration you could access the node.js server on the same port. The node.js server would run on another port.
For TCP based applications, no. You can have only one application listening on a single port at time. If you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP, both using port 8080.... but I doubt that is your case.
I guess you can run them on UDP protocol, which could allow you to have two applications listen to the same port, but as UDP is unreliable and it doesn't establish connection, just sends/receives packets. You might experience big packet loss on UDP.
So, short answer - no.
Actually, there might be a way using iptables. Add a rule of this nature
iptables -A INPUT \
-p tcp \
-m bpf --bytecode "14,0 0 0 20,177"
-j redirect .. Port 80
Check the first few bytes of the connection, and redirect the connection. Then you can accept both http and node.js on the same port, but have the servers running on separate ports.
The syntax above is incorrect, and I have not tried it, but I know people who have used this strategy successfully.

Xampp Apache module not working - 'waiting for localhost' error

I have encountered a problem when trying to preview PHP files using the Xampp control panel Apache module. Basically I open the control panel, click 'start', and have it minimised on my screen. I then navigate to a PHP page that I want to preview in my browser - but when I try to load it, it just sits there and says 'Waiting for Localhost' on the tab. The page never loads. Has anyone ever encountered this problem before, and if so, is there a simple fix?
Regards,
Robert Young
This happened to me and the problem was that some other application was listening on port 80. I couldn't figure out what it was. Usually, it would be Skype so I shut down Skype and I still had a problem connecting to localhost. The other application was Audible Download Manager which automatically starts when I start windows and you can usually see in the windows task manager. Once I closed the app, localhost started working.
This is how you figure out which application is listening on port 80.
Go to Start, then Run or type cmd and open cmd.exe. Then type:
cd desktop
netstat -a -b -p TCP >port_list.txt
After command runs, port_list.txt will be saved on your desktop. Open port_list.txt and go through the list and find the application listening to :http. Then find the application under processes in your windows task manager and end the process.
I had similar issue... Here is what you can do:
Step 1: on xampp control panel checkout netstat & look if any other application is using that port as your xampp
( If yes then shut down those applications using Task Manager)
Step 2: Irrespective of Positive or negative results of step 1, Just Turn off your firewall through control panel.
In my case I just had to turn firewall off & it did the miracle.

Check if a machine on local network is available with PHP

I have a PHP app runing on local network server (Mac Mini server with OS X Lion). There are several local clients (also Macs) accessing this app. Client machines are put to sleep from time to time. I need to be able to check from PHP server if the local clients are running (wake) or in sleep mode.
I have been successful of doing this with AJAX polling script, where I periodically ping the local machines and display status of a local machine in PHP app. The problem I have is that PING command initiates wake-on-lan on client machines if they are in sleep mode, and this is something I do not want. I would just like to see the status without waking the machine.
Can this be done?
check
pmset -g | grep hibernatemode
http://www.tuaw.com/2010/10/20/safesleep-lets-you-use-safe-sleep-on-demand-on-your-mac/
I would say you need to correctly configure the Wake-on-lan for those machines. Aparently they get awakened for every packet, which is probably not what you require. Usually WoL is configured to wake only on Magic Packet (on Windows it can be configured in Device Manager in the properties of network card driver). Then you will be able to use ping (or any other type of network traffic) to check if PC is online.

Gearman - Client

Researching PHP/Gearman. I'm trying to get an understanding of how the Gearman Server/Process determines what constitutes a "valid" client.
In the docs that I've seen, the docs show a number of clients connecting to the the Gearman Server. However, I've not found anything that describes how the server "validates" the workers, or restricts the workers/clients from accessing/getting work from the Server.
As an example, I create a Gearman Server, and I have a network with 5 child machines, each of which has a "worker". My evil friend Steve adds another machine to the network, with it's own worker..
How do I stop Steve's worker from getting work from my Server!
Is there a way to have the client/worker register itself, so I can essentially allocate IDs to the clients/workers???
I'm fairly certain that there's a way to do this, but I haven't come across it yet.
I'm testing on a Linux env, using PHP/MySQL/Gearman.
Thanks
Like memcached, gearman has no access control or authentication whatsoever.
Your best solution is to rely on your OS, e.g firewall rules.
Namely iptables should block all incoming traffic to port 4730 (standard gearman port), like this
iptables -A INPUT -p tcp --dport 4730 -s server1 -j ACCEPT
...
iptables -A INPUT -p tcp --dport 4730 -s server5 -j ACCEPT
iptables -A INPUT -p tcp --dport 4730 -j DROP
That way, you still can use Gearman from localhost.
Disclaimer : this rule is on top of my head, please double check these rules before running it on production server.
Hope this helps !
By listening (1) either only on localhost or (2) settings up proper firewall rules if you need outside access. Gearman is created with the intention of having as little overhead as possible, there is no authentication protocol. If this is not enough, only listening on localhost & using SSH tunnels to that machine is a possibility. Also a possibility is using the HTTP protocol (see here), and putting a validating proxy in front of it.
Gearman servers should only be accessible on your internal network. The network your application lives on should not have unauthorized devices on it. Your application servers shouldn't be sharing a network with your wireless router. Gearman will only send jobs to servers registered to that particular server with the same task name. If one of the employees at your company registers a task with the same name to your production Gearman master as a joke, you have bigger problems.

Categories