I have tried a few SSH and SCP snippets to transfer files from a web server to a windows pc and I can't quite get it working. There are a combination of things I believe I need such as firewall permissions, php modules, etc.
What boggles my mind is, it is so easy to ssh to a linux machine because I know the username and password but for Windows, you don't REALLY have a username and sometimes don't even have a password.
That being said, here is what I need to do. I have a linux server online and need to send a XML file to a windows pc. Out of your experiences, what are the best php modules, snippets, and any tips that you followed to achieve this? I believe the IP I would use for my windows machine would be my public ip but what in the world would the password be.. I have no pw on my computer? Do I need extra software installed on my windows pc as well?
Any help is appreciated.
Without getting into your IP potentially being dynamic.
It sounds like you need a cron job on the web server. You could then set up a FTP/SSH server on your Windows PC to receive the file.
On the other hand if this file is in a website folder which has FTP access. You could FTP to the server from your Windows pc and get the file with an FTP client.
Programs such as FTPBox could sync this for you or Curl from the command line.
With a command line program like Curl on your Windows PC you could set up a cron job on your Windows pc to automate getting this file if you want to do this automatically.
There are a few other options like a virtual linux machine on your windows pc. Then you could SSH from there and set up shared folders etc.
But to put it as simply as my experience has taken me.
If you have a webserver use FTPS and use a FTP client on your PC.
or use a command line program like Curl to automate from windows pc
From the server you need a cron job to automate the process, but you need to setup some type of server to receive this reliably. You could have a PHP file call a script file with php exec() depending on your webservers permissions.
Your router and software firewall may need to be configured to allow the ports you use for the transfer.
Easiest option is FTP server on webserver and FTP client on windows machine.
There are a few options, so I hope this has helped somewhat, I haven't taken into account a few things like security, automation, permissions etc. So none of these could be your best option. :)
Hope this helps a bit
Edit: Just to add Windows doesn't come with SSH which might explain some of the username/password issues. When you set up a FTP server on your Windows pc you can set your credentials
Here is a guide for setting up FTP Server on Windows PC
https://www.howtogeek.com/140352/how-to-host-an-ftp-server-on-windows-with-filezilla/
Once you have a server setup on your pc, if you wish to go down the route of a creating a cron job on your webserver for automation, you will havve your credentials from your server setup.
Related
Hello I am running tests on my XAMPP server.
Let's say we have the following scenario :-
My Laptop is running the server in a small Local Network.
And I am accessing my Server with my personal PC.
Is it possible to upload files to htdocs from my Personal PC to the Server Laptop?
If we assume that all security settings are turned off. Basically I need to remotely upload files to HTDOCS so I can use them from the server!
As far as I remember doesnt XAMPP come with a FileZilla server as part of the install?
So configure the fileZilla server on the laptop, create a userid and set that userid up to be able to see the htdocs folder.
Then install FileZilla client on the desktop PC. You can then use FTP ( FileZilla ) in just the same way you would if the site was running on a real hosted server.
FileZilla Server setup instuctions
No.
Web servers do not, by default, run any services that write file uploads to a directory on the server.
You'll need to run some kind of suitable service such as SFTP, Windows File & Print Sharing, or a web based file uploader script.
I have a standard filezilla FTP server running on my server and I'm wondering if I can get the log that displays in the interface to appear in a PHP web script (hosted on the same server) so I can monitor the FTP activity remotely.
Is this possible to do? Thanks! :)
Edit: I am aware that I can install the filezilla interface and log into the server interface remotely, however, my main client is a mac and there doesn't seem to be any program that can preform this task
Well you can just write a script to do this.
A simple way is to just:
<?php
echo file_get_contents('/path/to/ftp/log');
P/S: You can use filezilla on mac as well.
It seems like there are two ways to go, and the determining factor is whether you want to host on your own computer, or through a webhost.
If I have an IDE, a webhost server I subscribe to, and an FTP client to transfer my files to the server, then I don't need to install PHP, MySQL, and XAMP, right?
I know XAMP allows me make my computer website server.
When I install PHP, am I installing the intepreter for my computer/server to parse the .php files? (and same for MySQL?)
If I pay for web hosting, then their servers already have PHP and MySQL parsers, and all I need to do is upload my text files, right?
Thanks in advance
U just cant simply put the files in server without developing them.and if you want to develop any website or any webapp then u need to make your system a local server where you can execute your server side languages like php.XAMP is a short form for mysql,apache and php for windows.and 'website server' is not the proper word.use LOCALHOST instead because only u will have access to your server unless you are connected via LAN or WAN.so i can summarize the above in few points keeping in mind that you want to develop your website.
step 1:install XAMP
step 2:develop and test your scripts.
Step 3:if everything works fine than host your site in the webserver for everybody to see it.
We need to execute an .exe file in a remote Windows Azure Server.
We call it from PHP with shell_exec. The .exe should create new files in two different folders into the server and generate data entries in a data base and returns a string, but it doesn’t work.
We don’t have any problem executing it in our local server with windows 7 Enterprise and IIS 7. That’s why we thought it could be a permissions problem, and then we have created a .user.ini file with the following content:
safe_mode= off
safe_mode_exec_dir= off
Unfortunately it doesn’t work too.
Any suggestions?
Thanks in advance.
You are most probably working with Windows Azure Web Sites. This is a high-density shared hosting with tightened security. If you need things like shell_exec you shall move to Windows Azure Cloud Service (Web Role), where you have full control over the OS and web server / php settings.
Using Cloud Service you will be able to use shell_exec. However when you move to Cloud Service you have begin thinking of saving files in Azure Blob Storage, as the local storage for cloud service is:
Not persistent
not synchronized across role instances
If you want don't yet know what Role and Role Instance is, or are little confused, please go through this article.
I have to check something if it works.
We have limited access to a Debian server via ssh. We have a PHP intranet solution running on this server, so we can run PHP scripts. We got the following scenario:
A windows network drive given: \\IP\folder$
We have to read this windows network drive from PHP under linux. I never did such thing.
We have no any rights to mount anything on the server. This drive may or may not accessable from the linux machine, I don't know. (I guess it's accessable, due to the scenario).
We didn't receive any user&pass for the drive, so I guess we don't need it.
The question is: is it possible to do this in this situation if everything was set up correctly on the customer side? If yes, how?
We can ask more information and configuration changes if we need it, but I'm wondering if we can do this now, because it's interesting.
Thanks in advance,
negra
You can use smbclient to access the share. You could consider it as a sort of 'ftp' client, but for accessing Windows shares instead. It can work without need for mounting, and you should be able to talk to it directly from PHP using popen() for bi-directional communication of commands/results.
However, this depends on the share actually being remotely accessible, and you having access rights to it (via a windows account or the share having 'everyone/read' permissions). If windows networking is firewalled and/or you don't have access permissions, then there's nothing you can do to access the files directly.