SSH using NetBeans to Ubuntu - php

I want to edit a website hosted on Ubuntu 12.04 Server from Windows 8.1 through NetBeans 7.3.1 using SSH
I tried this but getting this error.
I can successfully SSH to that Ubuntu machine through other PCs.

This issue is not related to NetBeans. Host Name ubuntu provided is not a valid hostname.
Try running this command on Command Prompt (cmd):
ping ubuntu
It will most likely return with this error message:
Ping request could not find host ubuntu. Please check the name and try again.
It works on other PCs you mentioned in the question because:
They have the host in their hosts file (C:\Windows\System32\drivers\etc\hosts). E.g:
192.168.0.16 ubuntu
They are using different DNS servers
You can get the IP address of the Ubuntu machine by logging into it and getting the IP address from the response of the following command:
ifconfig
You can update your hosts file using the IP.

Related

Not able to open phpmyadmin in ubuntu (ec2 server)

I have followed amazon tutorial to install Apache2, mysql and php on ubuntu Ec2 and when tried to access phpmyadmin its not working.
Initially some other process was using port :80 so i was not able restart apache and then i have changed Listen:80 to Listen 8080 . Now apache working fine, but still no hope on phpmyadmin
Pls check attached screenshot:

SSH to wamp server apache / php from Linux Sub-System

I am trying to ssh to my Wamp Server 3.0.6 installation on Windows 10 from Linux SubSystem but it is asking me for a password. Trying to do a mysqldump of all databases but I don't have anymore an apache console so need to use this one. What password would this contain. I tried blank password, my own linux subsystem password but it's not that one.
Linux subsystem
You will not be able to SSH to the WAMP installation. SSH is something available from within the OS (not normally in Windows but in Linux). So on your Linux machine you have a SSH server installed and this allows you to connect to it via SSH.
What you want to do, is use the MySQL client on the Linux machine to access the MySQL server that is running on the Windows Machine.
For this you firstly need to ensure that the Windows machine has port 3306 open in the firewall and that the MySQL server has a user like 'user'#'%' or 'user'#'linux.machine.ip'.
Then on the Linux machine you can do:
mysqldump -u user -p -h windows.machine.ip database > backup.sql
That being said, it's likely going to be easier for you to run this command on the Windows machine:
mysqldump -u root -p database > backup.sql
I have not used WAMP in years but the MySQL client software is in something like wamp/bin/mysql, look for mysqldump.exe and from this folder can run the above command in command prompt.
As you'd not need to configure remote access to the MySQL server from within Windows. You can then just SFTP into the Linux box and upload the file or SCP to copy the file from Windows to Linux.
Regarding the default password for your MySQL install, it should be root with no password but bear in mind that the MySQL server needs a user account with remote access.
Also, if you're running that Linux box in a VM on the Windows box, check out Samba shares as you could share the Linux file system with the Windows machine, would make it easy to copy things back and fourth.

how to run apcahe2 localhost in nitrous.io Ubuntu Stack

I am running ubuntu stack on nitrous.io cloud platform.
I want to run php files on it and install apache2 server on it also.
But I am unable to run localhost on it;
It giving error of "port not specified" when I am taking preview of it, on port 3000.
Please help me out regarding this.
I am following this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
apache default port is 80
configure port
change the local host to 0.0.0.0 instead 127.0.0.1
This will solve the problem
[![enter configure the port ][2]2

How to connect remote Linux box through PHP in windows environment

I'm on a Windows XP machine, with Wamp installed. Currently, I am using putty to connect my remote Linux boxes.
I want to execute Linux commands through php shell_exec() method (cp, ls, ...).
Does anybody know how to connect my Linux box first and then run those commands in a Windows environment?
Any advice's would be highly appreciated...
You can't run Linux commands in Windows.
You can run them over SSH, using putty. It seems you have that running.
You can forward the connection over ssh. Look in the putty screen, go to Connection > SSH > Tunnels.
Then you add a tunnel:
source port: 1234
destination port: localhost:80
type is Local
So you open Internet Explorer, type in the addres bar: http://localhost:1234 the port 1234 is then forwarded to the port 80 on the remote linux pc.
You can also forward it to the WAMP by setting
destination port: *ip of the wamp server*:80
Then you can acces the Windows pc from outside the network, as long as putty is running.
It sounds like you want a PHP script on Windows to run SSH commands on a remote Linux server. For this, see the PHP SSH2 extension.
Bindings to the libssh2 library which provide access to resources
(shell, remote exec, tunneling, file transfer) on a remote machine
using a secure cryptographic transport.
This will allow you to connect to the Linux server via SSH and execute commands on the remove server (cp, ls, etc.). Here's some sample code:
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_exec($connection, 'hostname');
echo "Output: " . stream_get_contents($stream);
It's worth noting that this probably isn't the safest or most reliable way to go about this task.
I don't think you can execute linux commands on a windows machine.
You might want to consider using OpenSSH for Windows
and skip the php.
But you will get you a Windows Shell. C:\\> and no ls or cp, but otherwise full control.
You could also get experimental and run a Virtual machine with linux and share your windows drive with it.
remote server linux - - ssh - - > local virtual linux - - - shared folder - - > windows
You could either:
Install CYGWIN
Install SSH2 extension for PHP
There is an extended SSH2 class I use, which can be found here: SSH2 with Exception Handling.

Installing XAMPP on windows

I was trying to install XAMPP on my windows machine and while it is installing it says installing Apache server failed because port 80 and 443 are already in use.
Since Skype is also using this port, i have uninstalled Skype and started re-installing XAMPP server.
But still after uninstalling Skype i get the same error message when XAMPP server is installing. Could someone has faced this issue before share your ideas with me
Thanks in advance for any help
At a command prompt type
netstat -a -n -o
to see which process is using the ports.
It's probably IIS if you've got that installed.
One way to fix it is to specify non-standard ports for XAMPP to use, such as 8080 and 8443.
Have You IIS Service running?
just check that IIS Service, when it running just stop it, you can stop it from Computer managment > Services

Categories