(a) PHP
1. Download and install
http://www.appservnetwork.com/
Download appserv-win32-2.5.10 and install it from the above URL, and install PHP only when you install it.
Because, we only use PHP in it.
This is why this is done because PHP in Appserv contains the Php_pdo.dll library.
Assuming that the path to PHP after installation is: C:/APPSERV/PHP5
Copy the c:/appserv/php5/php.ini-recommended to the C:\WINDOWS directory and rename it to php.ini.
Copy the Php_pdo.dll and Php_pdo_sqlite.dll below the C:/appserv/php5/ext to the c:/windows directory.
Remove the comments from the c:/windows/php.ini, such as the next two lines.
Extension=php_pdo.dll
Extension=php_pdo_sqlite.dll
(ii) LIGHTTPD for Windows
1. Download and install
Can be downloaded from the following URL
Http://lighttpd.dtech.hu/LightTPD-1.4.35-1-IPv6-Win32-SSL.exe
However, this site seems to be very card. If you can't download it, you can download it from CSDN. The program has been uploaded below.
http://download.csdn.net/detail/crazycoder8848/8172761
Installation under Windows, needless to say.
2. Configuration
Enter the LIGHTTPD installation directory, open the Conf directory lighttpd.conf, do the following configuration
A) Turn on the CGI feature
Of course, you can also open other functions as needed. I modified the server.modules as follows.
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) Set some paths, assuming that the page content is in the C:/www directory
Server.document-root = "C:/www"
# # # # # # # of PHP parser paths Plus
Cgi.assign = (". php" = "c:/appserv/php5/php-cgi.exe",
". pl" = "c:/perl/perl.exe",
". CGI" = "C:/perl/perl.exe")
4. Start LIGHTTPD
Run the LightTPD.exe in the LIGHTTPD installation directory
(c) SQLite
Download a sqlite-shell from the following URL to create a database to test whether the environment has been successfully built.
Http://www.sqlite.org/2014/sqlite-shell-win32-x86-3080701.zip
After downloading, unzip to get Sqlite3.exe. It can be copied to the C:\WINDOWS directory, which is more convenient to perform under DOS.
(iv) Testing
A
Under DOS, go to the c:/www/databases directory and create a database
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 (ten), 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) in the C:/www/cig-bin directory, create a PHP script haha.php with the following content:
<! DOCTYPE html>
<body>
<?php
Phpinfo ();
echo "Hello my first php script \ 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 ']. " ";
}
?>
</body>
c) Use a browser to access the haha.php to see the effect:)
http://ip_of_lighttpd/cgi-bin/haha.php
If you are having trouble debugging a PHP program, you can open C:/windows/php.ini and set the following to open the error function of PHP:
error_reporting = E_all & ~e_notice
Display_errors = On
Build Lighttpd+php+sqlite under Windows platform