Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Ok this may seem like a very, very awkward question but here's my problem:
I need to be able to SSH to my site while at the library at my school but the only thing is that it NEVER works if I try to FileZilla it or puTTy it. I am not even using port 22 rather a separate port. Still it seams as if it is blocked.
I was wondering if I could use some package that I can add to my admin section on my site so I can ssh to my site directly from the browser (Also my school uses windows so doing ctrl+x in nano doesn't work.
I would preferably use PHP, as I can not use any other Server Side language (technical reasons) and I am pretty noob to websites and stuff, this is my first project as such.
PHP has an excellent built-in SSH package (via pecl): http://us2.php.net/manual/en/book.ssh2.php
If you don't already have it, here are installation instructions: http://us2.php.net/manual/en/install.pecl.intro.php
Check out phpSecLib. It implements the SSH protocol in PHP and is pretty common for this type of thing.
There are others available too if you search for something like "PHP SSH client"
It seems like you want to run commands on your own server. Installing an SSH library for PHP will not help you in that regard, unless you ssh from your server to itself. How about using a php web shell?
You'll have to make sure to secure it but it should allow you to run any commands you need within the browser.
The connection from your school to the Internet is probably protected by a firewall.
In the easiest case the workstations in your school have direct access to the Internet but the firewall blocks connections to most ports. If this is the case you can try running sshd on port 80, the port used for HTTP.
In a more complicated case the workstations must pass through a HTTP proxy in order to access web pages. Apparently Putty allows connecting to an SSH server through a HTTP proxy, you just have to configure it correctly.
None of this requires PHP modules as the connections are made directly to sshd.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
We have a web-application developed in PHP. But most of clients don't have internet connection all the time. So, is there way to convert the app into a desktop application so that it works stand alone and it syncs to web application whenever there is an internet connection? Currently I am testing it locally via xampp and it works but I dont want to have to install xampp or wamp on a clients pc. I am an amateur at coding FYI. I would appreciate any precise answer with example.
A nice and simple way to do that without having to go through XAMPP or LAMP installation making it really simple to your users is to use PHP built-in server as of PHP 5.4.0.
$ cd ~/public_html
$ php -S localhost:8000
You can test this by adding an index.php in the public_html directory and then just run the command $ php -S localhost:8000 inside public_html. Open up your browser and type localhost:8000 so you can see your index.php file.
Another important thing is that your users must have Mysql installed (or whatever DBMS you are currently using).
Source PHP documentation
To avoid installing server on every client pc you can use Virtual Machine, so you would have same environment and just copy to every pc you need.
To keep the source code up to date (when connected) use GIT or other version control system (SVN may be easier to get into).
You have to install mysql or whatever DBMS you are using at backend as well as install XAMPP or any other server to run PHP script. If you dont want to install full XAMPP you can use portable XAMPP which is just copy and paste.
You can right a script which can keep checking after specific intervals, if internet is available then synch database with live server.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have been asked to setup an online web server (e.g, digital ocean) and describe the steps I took. (e.g, installing and configuring private keys, firewall and web server).
And also what steps did I take to secure my setup?
I know very basic about php and HTML and this my first time setting up an online web server. My main question is that to set up an online web server I must pay money and buy space or I should use my own PC as a web server. which one is easier? I am trying to stick to the above question. Any help or reference to guide me will be appreciated.
There are a few elements to consider here, for the server, you need this
computer
operative system (windows, linux, mac, ...)
setting user access and user restrictions
setting a firewall
set remote access if needed (ssh, vnc)
For the web part of the question, you need this
web server software (apache, lighthttpd, nginx, iis, ...)
server side programming/scripting language if needed (perl, php, asp, ...)
If you can use a PC that you already have, use that one, after, you will have to mae that computer reachable from the exterior, for that, you have so give your external IP to the people that is going to use it, if you have a fixed ip, use that one, if you don't, then use something like dyndns.
Of course, if you have a router, then you have to configure that router to pass the requests to port 80 to your PC serving as web server. You can start learning about that process with this search about setting a NAT
You don't have to use a dedicated machine for this, you can also use a virtual machine on your existing system, check VirtualBox, one of the easiest to set up.
All that are just the most basic steps, some are very simple, some are more complex. Definitely you don't have to buy/rent a server, although, it may be easier that doing all the work yourself. If this is for a school/university assignment, check the conditions applied and if you can use a PC/virtual server on their machines. If this for work, hire somebody that knows how to do it and if you want to learn, stay close to that person.
Hmm paying would probably be easier but you wouldn't learn anything.
My advice would be download Debian linux and install it to a computer you don't use. Then install apache.
Debian is pretty easy to install, they supply a gui, but there's also a guide here that's very in depth.
Also apache is as easy as sudo aptitude install apache2, and your documents will need to be in /var/www to show up online. Make sure your ports are forwarded. A good guide, again, is the Debian documentation here.
As far as securing it goes, make sure ssh only accepts keys, and not passwords. Also close any ports you don't need.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Are there any good IDEs which can search for a word or phrase from the remote files without storing/synchroning to my local computer first?
I have tried Aptana, but it doesn't seem to be able to do this but, the remote file system is good(not store to local)
I have tried Netbeans, which seems to alway store files to my local machine first.
I hoping that there are (preferably free) IDEs out there that can run searches for strings on the my remote host?
I see three possible (common) options:
Connect via ssh and use vim. I would do that.
Mount the remote file system via scp (sshfs on Linux) or ftp (curlftpfs on Linux). This will hide file transmission from you but they will be done it background. So it's much the same as let the IDE do the ftp work
Have the IDE (whatever you prefer) running on the remote host and using RemoteDesktop or somewhat else.
I prefer ssh + vim :)
Using ssh may be the most secure and usual approach. The less data intensive will be using FTP with Aptana as you already doing (Expecting that Aptana just transmitts changed files). (Also this may depend on the filesize and circumstances but with usual code files I would say so)
If you are working on Windows expandrive might be an approach. It supports mounting remote servers a local netdrive in Windows via FTP, SSH or SFTP . An IDE would see that folder like a local folder. You should give it a try.
Update: Trying to explain more....
If you want to search in a remote file, you have two general options:
The search program runs locally and will need input data from remote (the file)
The serach program runs remotely. You'll send arguments to it, and it will send back the search results
No further options.
In IDE speaks it means: Either you use the search functionality of your IDE itself, means the search program (IDE) runs locally, then the file has to be downloaded / sychnronized / netmounted whatever. Or you execute grep or whatever remotely and display the results. Then it mostly comes to ssh. Your IDE will need a ssh plugin for that. Eclipse for example has one. (Think to remember the name was RSE. Remote Systems Explorer) (It will work with Aptana too) .
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
This is a theoretical question and hope you won't refuse it directly.
The problem I am having is that I am working both on front-end and back-end development. Basically by day I am fron-end developer which involves a lot of different browsers, Photoshop and other tools needed for design/fron-end work. But by night I am heavy php developer.
Now this is quite a tricky situation. As a back-end developer I would really love to use linux server, same as production servers for projects, which will be much easier to synchronize. But as a front-end developer I need all the tools, that are available mostly for windows.
I have been looking long time for a solution OTHER than virtual linux machine. Finally i ran into the Cygwin. It looks promissing, but my question is, can I fully simulate linux webserver with this tool? are there any limitations?
I would appreciate any opinion, also if you know about some elegant way/tool how to achieve what I need, please share it with me.
Thank you!
EDIT:
Why I don't want to use virtual machine:
It takes too much RAM. If I run IDE, Photoshop, Virtual Machine etc. my PC has hard time to catch UP
I am looking for "seamless" solution. Something that can run quietly on my background, best as a service.
File sharing. I know it is possible to share files between PC and virtual machine but I just don't feel like it is very elegant solution
I had something more on my mind, but this is what I could come up with so far.
Basically Linux is pretty amazing, and I just cannot believe there would not be any simplier, less-robust solution to this problem than installing whole linux system.
Wish I could help more, but right from cygwins website it says "Cygwin is not: a way to run native Linux apps on Windows."
That said, it appears some people have got a lamp stack working in Cygwin and also here
So it sounds possible, but I have to re ask the question of why you would want to. Seems extraordinarily complex when you could install virtualbox and a turn key linux solution to get a real environment that is much easier to troubleshoot.
If you do get it working, I'd love to see a blog post on how you got it.
It depends what you mean by "fully simulate".
You can run an apache web server in cygwin, but it is quite difficult to set up. By a strict definition of "fully simulate" this is already quite different, the steps to set up the web server are different from a real linux machine.
Given that PHP already abstracts a lot of the underlying system away from you, you might find that there is really very little difference (for most purposes) in going down this path vs just installing wamp for your development.
Rather than install a virtual machine on your dev system you could also get a free amazon instance (for the first year) and do your web dev on that.
You can run Apache with PHP on a windows machine without any hassle at all. You do not even need Cygwin.
I run Apache+PHP and use it for development. I have not had any problems with transferring to a Linux machine. I use FTP Sync to update the Linux machine with just a click on an icon and it just updates the necessary files.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
With HTML files, I can work locally and preview the files in my browser after I've saved and made changes (and use LiveReload), but with PHP the browser just loads the code. Do I need to run a local server to work on it locally, or is there an easier way?
The extent of my PHP is using include statements for headers and footers.
Yes you will need a local server to run PHP scripts locally. Check out MAMP for Mac or XAMPP for PC.
Yes, you'll need to install something such as WAMP
No - since php is a serverside interpreted language you have to run a server. The easiest way is to install xampp whick brings everything you need - apache, mysql, php.
On windows you could also install IIS server which is part of windows
You can very easily download and set up a server - and on that note, yes do do need to have PHP and Apache set up to have PHP working.
I would probably suggest something like WAMP - it is basically pre-setup and requires very little config to get up and running. This will come with Apache Server, MySQL and PHP set up nicely to work together and comes with a very easy to use point and click interface. Oh, and it even installs PHPMyAdmin so that you can easily work with your databases if you are not familiar with console controls.
You need to set up a server that can serve php requests appropriately. However, this is incredibly easy to do. Just google how to install a LAMP server (on Linux), or look into WAMP (on windows). If this is still too much for you, look into purchasing a shared hosting account or something. I have a small one for like $15 a year. They will have the servers set up with everything you need already; you'll just have to upload the files.
Yes, you need to run a local server to 'work with it'. I would suggest XAMPP. To actually edit the files, you of course need a text editor. Any editor will do as far as I'm aware, but I use Notepad++ myself, or even the NetBeans IDE.