Viewing an FTP server log in PHP - php

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.

Related

How do I upload a file in a remote location to my localhost website?

I have a localhost port forwarded SSH tunnel between an Azure Linux VM and Localhost PC using PUTTY. So when I localhost:8080 on my windows PC, I see my static website hosted on the AzureVM.
I need to upload some remote files to this website. At the moment when I click the file upload on the localhost website, it searches for files on my local windows pc.
Is there any way I could make it look for files on another server(Or the same azure VM) or maybe Azure Blob storage?
Thanks!
Ok to upload through putty is a tedious process as you need code running on the linux machine to do it .
We generally use putty to control the AWS machine and run commands directly on it and use another FTP program like File Zilla , WinSPC or somthing similar for uploading
To upload a program directly with putty you have to write the protocol yourself or use a putty add-ons but its a pain to work with .
here some choices
https://helpdeskgeek.com/free-tools-review/the-best-ftp-tools-to-transfer-files-to-your-website-domain/
If you really want to go through the headaches of using putty to transfer files use this link as a start
https://www.hostknox.com/tutorials/ssh/putty/file-transfer

PHP - Transfer file from Server to Windows PC

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.

What is the best and easiest way to access files within a linux vps using its external ip?

I have a game server running in a vps with centos 6 .
The game server stores its status data on a text file and i want to access this file from my website server with php.
The problem is that it is better to do it without installing something link ftp server on the vps. Also i do not know how to set the ftp account directory to my game server directory.
Anyone knows any other simpler way to do so ?
Thanks.
Use a client which supports SFTP if you are able to connect to your server via SSH.
phpseclib handles the SFTP connection without the need to install an extension. For an example on how to download a file with SFTP go here.
If you don't have a webserver installed on your vps, you can use an sftp connection with php, check this question to help you implement it.
sFTP being available by default on most linux OSs you shouldn't have much trouble doing this;

How to access xampp server?

I installed XAMPP server in a rackspace cloud server. Now I want to access it from my local PC, like accessing web server through IP and coding & executing. Any solution would be grateful received.
If you want to connect to remote server from local machine, then
you can use PuTTY - http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Here is a brief tutorial on how to use it:
http://www.gamexe.net/other/beginner-guide-ssh/
or you can search for another one.
There are many articles about PuTTY.
How about using FTP to write your code and execute. I work directly off my server I use Netbeans as my IDE of choice and it has a ftp feature that lets you work with files directly off your server.
Is that what you meant when you wrote:
web server through IP and coding & executing

Do I need to install PHP, MySQL, and something like XAMP, if I already have an IDE, a webhost, and FTP client?

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.

Categories