(一)php
1. 下载及安装
http://www.appservnetwork.com/
从上面的网址下载appserv-win32-2.5.10并安装,在安装的时候,只选择安装php。
因为,我们只使用其中的php。
这所以这样做,是因为AppServ中的php,里面包含了php_pdo.dll这个库。
假设安装后,php的路径为:C:/AppServ/php5
将C:/AppServ/php5/php.ini-recommended拷贝到C:\WINDOWS目录下,并改名为php.ini。
将c:/AppServ/php5/ext下面的php_pdo.dll与php_pdo_sqlite.dll拷贝到C:/WINDOWS目录下。
将C:/WINDOWS/php.ini中,如下两行的注释去掉。
extension=php_pdo.dll
extension=php_pdo_sqlite.dll
(二)lighttpd for windows
1. 下载并安装
可以从以下网址下载
http://lighttpd.dtech.hu/LightTPD-1.4.35-1-IPv6-Win32-SSL.exe
不过,这个网址好像很卡。要是下载不了,可以从csdn下载。在下已经将此程序上传。
http://download.csdn.net/detail/crazycoder8848/8172761
windows下的安装,就不用说了。
2. 配置
进入lighttpd安装目录,打开conf目录下的lighttpd.conf,做如下配置
a)打开cgi功能
当然,你也可以根据需要,打开其他的功能。我修改后的server.modules如下。
server.modules = (
"mod_access",
"mod_accesslog",
# "mod_alias",
# "mod_auth",
"mod_cgi",
# "mod_cml",
# "mod_compress",
# "mod_evasive",
# "mod_evhost",
# "mod_expire",
# "mod_extforward",
# "mod_fastcgi",
# "mod_flv_streaming",
# "mod_magnet",
# "mod_mysql_vhost",
# "mod_proxy",
"mod_redirect",
"mod_rewrite",
# "mod_rrdtool",
# "mod_scgi",
# "mod_secdownload",
# "mod_setenv",
# "mod_simple_vhost",
# "mod_ssi",
"mod_status",
# "mod_trigger_b4_dl",
# "mod_userdir",
# "mod_usertrack",
# "mod_webdav"
)
b) 设置一些路径,假设网页内容在c:/www目录中
server.document-root = "C:/www"
#### php解析器的路径加上
cgi.assign = ( ".php" => "C:/AppServ/php5/php-cgi.exe",
".pl" => "C:/Perl/perl.exe",
".cgi" => "C:/Perl/perl.exe" )
4. 启动lighttpd
运行LightTPD安装目录中的LightTPD.exe即可
(三)sqlite
从以下网址下载一个sqlite-shell,用于创建一个数据库,用于测试环境是否已经搭建成功。
http://www.sqlite.org/2014/sqlite-shell-win32-x86-3080701.zip
下载后,解压得到sqlite3.exe。可以将他拷贝到C:\WINDOWS目录下,这样在dos下执行时更方便。
(四)测试
a)
在dos下,进入c:/www/databases目录,创建一个数据库
C:\www\databases>sqlite3 test.db
SQLite version 3.8.7.1 2014-10-29 13:59:56
Enter ".help" for usage hints.
sqlite> create table my_friends(name varchar(10), age smallint);
sqlite> insert into my_friends values('tom',22);
sqlite> insert into my_friends values('liyan',21);
sqlite> select * from my_friends;
tom|22
liyan|21
sqlite> .quit
C:\www\databases>
b) 在c:/www/cig-bin目录下,创建一个php脚本haha.php,内容如下:
//phpinfo();
echo "hello 我的第一个php脚本\n";
echo getcwd();
$file_db = new PDO('sqlite:../databases/test.db');
$result = $file_db->query('SELECT * FROM my_friends');
foreach($result as $row)
{
echo " name: ".$row['name']." ";
}
?>
c) 用浏览器访问haha.php看看效果吧 :)
http://ip_of_lighttpd/cgi-bin/haha.php
如果在调试php程序时,遇到问题,可以打开c:/windows/php.ini,设置如下内容,以打开php的报错功能:
error_reporting = E_ALL & ~E_NOTICE
display_errors = On

Thedifferencebetweenunset()andsession_destroy()isthatunset()clearsspecificsessionvariableswhilekeepingthesessionactive,whereassession_destroy()terminatestheentiresession.1)Useunset()toremovespecificsessionvariableswithoutaffectingthesession'soveralls

Stickysessionsensureuserrequestsareroutedtothesameserverforsessiondataconsistency.1)SessionIdentificationassignsuserstoserversusingcookiesorURLmodifications.2)ConsistentRoutingdirectssubsequentrequeststothesameserver.3)LoadBalancingdistributesnewuser

PHPoffersvarioussessionsavehandlers:1)Files:Default,simplebutmaybottleneckonhigh-trafficsites.2)Memcached:High-performance,idealforspeed-criticalapplications.3)Redis:SimilartoMemcached,withaddedpersistence.4)Databases:Offerscontrol,usefulforintegrati

Session in PHP is a mechanism for saving user data on the server side to maintain state between multiple requests. Specifically, 1) the session is started by the session_start() function, and data is stored and read through the $_SESSION super global array; 2) the session data is stored in the server's temporary files by default, but can be optimized through database or memory storage; 3) the session can be used to realize user login status tracking and shopping cart management functions; 4) Pay attention to the secure transmission and performance optimization of the session to ensure the security and efficiency of the application.

PHPsessionsstartwithsession_start(),whichgeneratesauniqueIDandcreatesaserverfile;theypersistacrossrequestsandcanbemanuallyendedwithsession_destroy().1)Sessionsbeginwhensession_start()iscalled,creatingauniqueIDandserverfile.2)Theycontinueasdataisloade

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver Mac version
Visual web development tools

SublimeText3 Chinese version
Chinese version, very easy to use
