Using PHP to implement an efficient and secure FTP server (i), PHP implementation of the FTP server _php tutorial

Source: Internet
Author: User
Tags ftp client ssl certificate

Using PHP to implement an efficient and secure FTP server (a), PHP implementation of FTP server


Summary:

This paper mainly describes the use of PHP swoole extension to implement the FTP server, while extending the FTP server personalization features and security. Truly achieve a fully controlled FTP server, you can customize the FTP server.

  

Body:

FTP server Presumably everyone is not unfamiliar, use up, ready-made software is also a lot. However, the free software features sometimes do not meet their own needs, and can not be developed two times, the price of paid software is relatively high. PHP's swoole extension is the PHP language's high-performance network communication framework that provides the PHP language for asynchronous multithreaded servers, asynchronous TCP/UDP network clients, asynchronous MySQL, database connection pooling, Asynctask, Message Queuing, millisecond timers, asynchronous file read and write, Asynchronous DNS queries.

Swoole can be widely used in the Internet, mobile communications, enterprise software, online games, Internet of things, car networking, smart home and other fields. The use of Php+swoole as a network communication framework can greatly improve the efficiency of enterprise IT research and development teams and focus on the development of innovative products.

The Swoole has a built-in asynchronous non-blocking, multi-threaded network IO server. PHP programmers only need to deal with event callbacks, without having to worry about the underlying. Unlike a fully asynchronous framework such as Nginx/tornado/node.js, Swoole supports both full-async and synchronous.

With this foundation, server development based on the TCP/IP protocol becomes easier. Perhaps people will ask, C # and other languages can also be implemented Ah, why use PHP? I think the main consideration is the development efficiency. PHP is a scripting language that does not have to be compiled and is fast to develop.

Needless to be said, the steps are listed here:

00 Prepare the platform, I use the CentOS7 here;

01 Install PHP and Swoole extensions, please refer to http://wiki.swoole.com/wiki/page/6.html;

02 Set character sets, because the FTP processing file name is prone to garbled, it is recommended that the operating system's character set to GB18030, which is consistent with windows, most of the FTP client currently supports UTF8 file name encoding, but the use of less than satisfactory. How to good solution please hesitate to inform, thank you very much;

03 Start to write PHP program, test PHP program;

04 Deployment of the PHP version of the FTP server.

The purpose of this paper is to realize the functions of FTP server:

* User, group management; * Password self-modification and reset; * folder Rights management; * IP access control; * Online user view; * disk space usage view; * SSL support, protect password and file transmission security; * Built-in Web Management page for remote management.

 
Project directory:
Ftpserver
|
+-conf
| |
| +-config.php//ftp configuration file
| +-SSL.CRT//SSL Certificate
| +-ssl.key//ssl Key
|
+-inc
| |
| +-csmtp.php//SMTP e-mail class for FTP password sending and resetting
| +-sharememory.php//Shared memory operation class
| +-user.php//user management, file Rights Management, IP access control
|
+-logs//log file
|
+-reference//reference documents
|
+-web
| |
| +-wwwroot//ftp Web Administration Web site
| +-cwebserver.php//ftp built-in HTTP server
|
+-cftpserver.php//FTP Server Main program
+-myftpserver.php //ftp Entrance procedure

Not to be continued ...

Example program See http://share.realdatamed.com

http://www.bkjia.com/PHPjc/1082226.html www.bkjia.com true http://www.bkjia.com/PHPjc/1082226.html techarticle using PHP to implement an efficient and secure FTP server (a), PHP implementation of FTP Server summary: This article mainly describes the use of PHP swoole extension to implement the FTP server, while extending the FTP server personality ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.