PHPlet是什么?
很简单,它是一个使用PHP编写的Web服务器,可以替代我们常用的Apache或IIS。
为什么要介绍PHPlet?
因为它是PHPer们学习Web服务器原理的捷径。
因为它的程序结构很好,类似Java的面向对象编程,有很好的参考价值。
因为我认为PHP5和PHPlet相继发布稳定版本后,PHP5+PHPlet+SQLite(PPS)将是小型应用、程序演示的另外一种选择。
现在大部分的小型应用或者程序演示都是把Apache+PHP+MySQL(APM结构)做成exe或rpm安装包,它的容量在8M-45M左右。如果使用了PPS结构整个系统将会缩减到2-3M之内(SQLite是嵌入式数据库),而且省去了对Apache和MySQL的依赖。
PHPlet的运行方式?
PHPlet使用php_socktes.dll实现端口侦听。
PHPlet是常驻内存的,可以使用srvany.exe将它作为NT的服务运行。
PHPlet的多进程功能只能运行在Linux、FreeBSD、*unx系统等系统下,这是因为PHP的“进程控制函数库”不支持Win32平台。
好了,废话不多说,马上进入我们的PHPlet之旅。
一.资源下载:
l PHP
ZIP-Format: http://cn.php.net/download/
TGZ-Format: http://cn.php.net/download/
要下载最新的稳定版本,这样会得到更好的性能和稳定性。我用的是PHP4.3.6,写这篇文档时PHP5还在测试阶段。
要下载ZIP包而不是安装包,因为安装版(其实是简化版)中没有我们需要的DLL动态链接库。
l PHPlet
ZIP-Format: http://phplet.sourceforge.net/
TGZ-Format: http://phplet.sourceforge.net/
要下载最新的稳定版本,这样会得到更好的性能和稳定性。我用的是PHPlet0.0.7,写这篇文档时还没有稳定版本。
二.安装:
l PHP
解压缩到D:\PHP4:
如果你是初学者最好释放到我说的目录,否则后面会带来一些麻烦。
创建cli_php.exe:
将D:\PHP4\cli\php.exe复制到D:\PHP4\cli_php.exe。
它是PHPlet的启动程序,复制到D:\PHP4是为了能跟php.exe共享php.ini。
PEAR的安装:
PHPlet扩展了Pear的类库,那么我们先来安装Pear。
前提是你的电脑处于连线状态,因为安装程序需要下载一部分组件(还没研究如何不下载)。
另外你的身份必须是Administrator,因为安装程序中会在Windows目录下创建pear.ini。
一切准备就绪后运行D:\PHP4\go-pear.bat开始安装。
第一步. 直接按回车(也可以CTRL+C退出:D):
Welcome to go-pear!
Go-pear will install the 'pear' command and all the files needed by
it. This command is your tool for PEAR installation and maintenance.
Go-pear also lets you download and install the PEAR packages bundled
with PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit-0.6.2.
If you wish to abort, press Control-C now, or press Enter to continue:
第二步. 输入Pear下载地址:
用来指定Pear组件的下载地址和端口,可以直接按回车。
HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none::
第三步. PHP路径设置:
一共7项,输入相应的序号就可以修改,输入"all"是修改全部,一般情况下只需要修改第7项。
选择第7项后会弹出一个windows的选择目录对话框,选择D:\PHP4。
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation prefix : D:\PHP4
2. Binaries directory : $prefix
3. PHP code directory ($php_dir) : $prefix\pear
4. Documentation base directory : $php_dir\docs
5. Data base directory : $php_dir\data
6. Tests base directory : $php_dir\tests
7. php.exe path :
1-7, 'all' or Enter to continue:
4. Confirm:
Confirm whether some components are installed. Enter "Y" here because PHPlet is using them.
The following PEAR packages are bundled with PHP: DB, Net_Socket, Net_SMTP,
Mail, XML_Parser, PHPUnit-0.6.2.
Would you like to install these as well? [Y/n] :
5. Install or download components:
Please wait a few minutes, the installer will automatically download the components and install them.
If there is an error in downloading "PHPUnit-0.6.2", an error will be reported. At this time, you need to check your network connection. (As long as the network is normal, there will generally be no problem. You can visit http://pear.php.net to try)
Loading zlib: ok
Using local package: PEAR..... ...ok
Using local package: Archive_Tar......ok
Using local package: Console_Getopt....ok
Using local package: XML_RPC.......... ok
Bootstrapping: PEAR.............(local) ok
Bootstrapping: Archive_Tar............(local) ) ok
Bootstrapping: Console_Getopt............(local) ok
Using local package: DB.............ok
Using local package: Net_Socket.....ok
Using local package: Net_SMTP.....ok
Using local package: Mail..... ok
Using local package: XML_Parser....ok
Downloading package: PHPUnit-0.6.2....
Okay, Pear has been installed here.
Modify php.ini:
Rename D:PHP4php.ini-dist to php.ini, and then open it.
Found:
; Windows: "path1;path2"
;include_path = ".;c:phpincludes"
Changed to:
; Windows: "path1;path2"
include_path = ".;D:PHP4includes;D:PHP4PEAR"
Find: extension_dir = "./" Change to: extension_dir = "D:PHP4extensions"
Find:;extension= php_sockets.dll Change to: extension=php_sockets.dll
l PHPlet
Unzip to D:PHP4PHPlet:
If you are a beginner, it is best to release it to what I said directory, otherwise it will cause some trouble later.
Change the configuration file:
Open D:PHP4PHPletconfigphplet.conf
"WEB_ROOT" is modified to: "D:\PHP4\PHPlet\www"
"HTTP_HOSTNAME" is modified to: "localhost"
"HTTP_HOSTPORT" is modified to: "8080"
"HTTP_SERVER_MODE" is modified to: "sequential"
"HTTP_SERVER_DEBUG" is modified to: "false"
"PHP_EXECUTABLE" is modified to: "D:\PHP4 \php.exe"
"CLASSLOADER_SINTAX_CHECK" modified to: "false"
Change startup file:
Open D:PHP4PHPletbinphpletstart.bat
link: http://www.knowsky.com
"PHP_EXE" is modified to: D:PHP4cli_php.exe
3. Start! Start the server!
Go to D:PHP4PHPletbin and double-click phpletstart.bat to start the service.
Okay, open the browser and enter http://localhost:8080/phplet/HelloWorld to see the effect.
4. Performance test
It was found that as long as it is run once, no matter how much modification (or even deletion) is made to HelloWorld.php, it will not change the result of the second refresh (it is very similar to Java Servlet, right?), unless it is restarted Start the server. So I feel that its performance must be great. As expected, please see my test results:
Server A (PHP4+PHPlet), especially a terrible AMD K6-2 400 + 128M.
Client B (Windows2003+IE6), P42.6G + 500M
Client B enters the URL http://192.168.0.15:8080/PHPler/HelloWord.php and then holds down F5 for 1 minute, Server A The CPU usage is constantly at 60%. If it is Apache2+PHP4 (CGI mode), refreshing at this frequency will continue to be 100%. After a long time, the virtual memory may be used up!
Of course, the above is only a one-sided test. As a WEB service, the more important thing is stability. Due to time constraints, there is no time for more detailed testing. We can discuss it together after doing more tests.
5. Notes
1. As mentioned above, PHPlet programming is somewhat similar to Java Servlet. As long as it is run once, no matter how much changes (or even deletions) are made to .php, the result of the second refresh will not be changed.
2. It is best to set the HTTP_HOSTNAME (host name) of PHPlet to your IP instead of localhost, otherwise other hosts cannot access through your IP.
3. Do not use exit in the program, use return to exit, otherwise the PHPlet server will be shut down.
4. You should use the $response->write() method to input a string, because print or echo will output the string to the terminal.
5. PHPlet does not support virtual directories and virtual host functions.
6. Conclusion
I have not been exposed to Pear, PHPlet and Socktes function libraries before writing this article, so some terms may not be accurate enough. Corrections are welcome!
Friends who are familiar with PHPlet and other web servers hope to communicate with each other. If you have any questions, you can also write to me.
Contribute your meager strength to China’s PHP cause ---- Mao Song

c盘的users是用户文件夹,主要存放用户的各项配置文件。users文件夹是windows系统的重要文件夹,不能随意删除;它保存了很多用户信息,一旦删除会造成数据丢失,严重的话会导致系统无法启动。

1.处理器在选择电脑配置时,处理器是至关重要的组件之一。对于玩CS这样的游戏来说,处理器的性能直接影响游戏的流畅度和反应速度。推荐选择IntelCorei5或i7系列的处理器,因为它们具有强大的多核处理能力和高频率,可以轻松应对CS的高要求。2.显卡显卡是游戏性能的重要因素之一。对于射击游戏如CS而言,显卡的性能直接影响游戏画面的清晰度和流畅度。建议选择NVIDIAGeForceGTX系列或AMDRadeonRX系列的显卡,它们具备出色的图形处理能力和高帧率输出,能够提供更好的游戏体验3.内存电

启动任务管理器的三个快捷键是:1、“Ctrl+Shift+Esc”,可直接打开任务管理器;2、“Ctrl+Alt+Delete”,会进入“安全选项”的锁定界面,选择“任务管理器”,即可以打开任务管理器;3、“Win+R”,会打开“运行”窗口,输入“taskmgr”命令,点击“确定”即可调出任务管理器。

PIN码是Windows系统为了方便用户本地登录而独立于window账户密码的快捷登录密码,是Windows系统新添加的一套本地密码策略;在用户登陆了Microsoft账户后就可以设置PIN来代替账户密码,不仅提高安全性,而且也可以让很多和账户相关的操作变得更加方便。PIN码只能通过本机登录,无法远程使用,所以不用担心PIN码被盗。

win10自带的onenote是UWP版本;onenote是一套用于自由形式的信息获取以及多用户协作工具,而UWP版本是“Universal Windows Platform”的简称,表示windows通用应用平台,不是为特定的终端设计的,而是针对使用windows系统的各种平台。

因为win10系统是不自带扫雷游戏的,需要用户自行手动安装。安装步骤:1、点击打开“开始菜单”;2、在打开的菜单中,找到“Microsoft Store”应用商店,并点击进入;3、在应用商店主页的搜索框中,搜索“minesweeper”;4、在搜索结果中,点击选择需要下载的“扫雷”游戏;5、点击“获取”按钮,等待获取完毕后自动完成安装游戏即可。

在windows中鼠标指针呈四箭头时一般表示选中对象可以上、下、左、右移动。在Windows中鼠标指针首次用不同的指针来表示不同的状态,如系统忙、移动中、拖放中;在Windows中使用的鼠标指针文件还被称为“光标文件”或“动态光标文件”。

windows操作系统的特点包括:1、图形界面;直观高效的面向对象的图形用户界面,易学易用。2、多任务;允许用户同时运行多个应用程序,或在一个程序中同时做几件事情。3、即插即用。4、出色的多媒体功能。5、对内存的自动化管理。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
