Build Lighttpd+php+sqlite under Windows platform

Source: Internet
Author: User
(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 in 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:





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 ']. " ";
}


?>







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

  • 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.