Build lighttpd + php + sqlite on windows

Source: Internet
Author: User
Tags php error reporting
Build lighttpd + php + sqlite (1) php on windows

1. download and install

Http://www.appservnetwork.com/

Download the appserv-win32-2.5.10 and install it from the above URL. when installing it, only select install php.

Because we only use php.

This is because php in AppServ contains the php_pdo.dll Library.

Assume that the php path is C:/AppServ/php5 after installation.

Copy C:/AppServ/php5/php. ini-recommended to the C: \ WINDOWS directory and change it to php. ini.

Copy php_pdo.dll and php_pdo_sqlite.dll under c:/AppServ/php5/ext to the C:/WINDOWS directory.

Remove the comments of the following two lines from C:/WINDOWS/php. ini.

Extension = php_pdo.dll
Extension = php_pdo_sqlite.dll

(2) lighttpd for windows

1. download and install

Download from the following URL:

Http://lighttpd.dtech.hu/LightTPD-1.4.35-1-IPv6-Win32-SSL.exe

However, this website seems to be very slow. If the download fails, you can download it from csdn. This program has been uploaded later.

Http://download.csdn.net/detail/crazycoder8848/8172761

You don't need to talk about windows installation.

2. configuration

Go to the lighttpd installation directory, open lighttpd. conf under the conf directory, and perform the following configuration:

A) enable the cgi function.

You can also enable other functions as needed. The modified server. modules is as follows.

Server. modules = (
"Mod_access ",
"Mod_accesslog ",
# "Mod_alias ",
# "Mod_auth ",
"Mod_cgi ",
# "Maid ",
# "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. assume that the webpage content is in the c:/www directory.

Server.doc ument-root = "C:/www"
#### Add the path of the php parser

Cgi. assign = (". php" => "C:/AppServ/php5/php-cgi.exe ",
". Pl" => "C:/Perl/perl.exe ",
". Cgi" => "C:/Perl/perl.exe ")


4. start lighttpd

Run lighttpd.exe in the lighttpdinstallation directory.

(3) sqlite

Download an sqlite-shell from the following URL to create a database and test whether the environment has been set up successfully.

Http://www.sqlite.org/2014/sqlite-shell-win32-x86-3080701.zip

After the download, decompress it to sqlite3.exe. You can copy it to the C: \ WINDOWS directory, which makes it easier to execute it in dos.


(4) test

A)

In 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 (10), age smallint );
Sqlite> insert into my_friends values ('Tom ', 22 );
Sqlite> insert into my_friends values ('liany', 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 haha. php :)

Http: // ip_of_lighttpd/cgi-bin/haha. php


If you encounter problems when debugging the php program, open c:/windows/php. ini and set the following content to enable the php error reporting function:

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.