Вы находитесь на странице: 1из 5

17/03/2011

Running LightTPD, MySQL, and PHP o

How To: Run PHP5 at 1and1.com

Running LightTPD, MySQL, and PHP on Windows 7


This is a how-to for running LightTPD, MySQL, and PHP on Windows 7 using no services, and can be stopped/started with the click of a button. If youre as anal as I am, you hate having services or processes running on your computer that you dont need (Im looking at you Google Updater and you too Apple Updater). If youre not using your webserver, why have it running? This set-up is also very portable; if you choose to, this setup will work on a thumb-drive. Files needed: LightTPD for Windows: http://en.wlmp-project.net/downloads.php?cat=lighty Download the ZIP package (no set-up). MySQL : http://dev.mysql.com/downloads/mysql/5.1.html#downloads Download the Without Installer package PHP: http://www.php.net/downloads.php Download the Windows Binary ZIP package HSTART: http://www.ntwind.com/software/utilities/hstart.html General Set Up 1. 2. 3. 4. 5. 6. Create a directory C:\Web Create the directories C:\Web\Docs, C:\Web\LightTPD, C:\Web\PHP, C:\Web\MySQL Extract hstart.exe into C:\Web Extract all the LightTPD files into C:\Web\LightTPD Extract all the PHP files into C:\Web\PHP Extract all the MySQL files into C:\Web\MySQL

Setting Up Lighty 1. 2. 3. 4. Open C:\Web\LightTPD\conf\lighttpd-srv.conf with notepad Set server.errorlog to C:\Web\LightTPD\logs\error.log Set accesslog.filename to C:\Web\LightTPD\logs\access.log Change the bottom includes to be include "C:\Web\LightTPD\conf\lighttpd-tag.conf" include "C:\Web\LightTPD\conf\lighttpd-inc.conf"

5. Open C:\Web\LightTPD\conf\lighttpd-inc.conf 1. Uncomment (remove the pound-sign) from mod_fastcgi 2. Set server.document-root to C:/Web/Docs 3. Add the line fastcgi.server = ( ".php" =>( "localhost" =>("host" => "127.0.0.1","port" =>
3 4

Setting Up PHP 1. Open C:\Web\PHP\php.ini-development 2. Uncomment (remove the semicolon) from extension=php_mysqli.dll Side note: I am using the PHP 5.3 release candidate, which may have different php.ini names. Creating the Start-Up and Shut-Down Scripts
bragilabs.com//running-lighttpd-my 1/5

17/03/2011

Running LightTPD, MySQL, and PHP o

1. Create C:\Web\Start.bat and add to it:

@ECHO OFF hstart.exe /NOCONSOLE "PHP\php-cgi.exe -c PHP\php.ini-development LightTPD\LightTPD.exe -f LightTPD\conf\lighttpd-srv.conf -m LightT hstart.exe /NOCONSOLE "MySQL\bin\mysqld.exe" EXIT

Be sure to set the php.ini to the correct one in the command above. 2. Create C:\Web\Stop.bat and add to it: @ECHO OFF MySQL\bin\mysqladmin --user=root --password= shutdown LightTPD\bin\PROCESS.EXE -k LightTPD.exe >nul LightTPD\bin\PROCESS.EXE -k php-cgi.exe >nul EXIT

Make An Easy-To-Use Button 1. Right-click on hstart.exe and create a shortcut. 2. Rename the shortcut to Start. 3. Right-click on the shortcut, go to properties and set the Target field to C:\Web\hstart.exe /NOCONSOLE /WAIT "C:\Web\Start.bat" /TIT

4. 5. 6. 7. 8.

Change the icon to something more suitable (optional) Hit OK Right-click on hstart.exe and create another shortcut. Rename the shortcut to Stop Right-click on the shortcut, go to properties and set the Target field to C:\Web\hstart.exe /NOCONSOLE /WAIT "C:\Web\Stop.bat" /TITL

9. Change the icon to something more suitable (optional) 10. Hit OK 11. Place the two new shortcuts in a convienant spot All done!
June 14th, 2009 | Category: Computer Tips & Tricks, How To

14 comments to Running LightTPD, MySQL, and PHP on Windows 7


MySchizoBuddy
September 12th, 2009 at 2:46 pm loading http://localhost:521 doesnt show the lighttpd welcome page

bragilabs.com//running-lighttpd-my

2/5

17/03/2011

Running LightTPD, MySQL, and PHP o

[Reply] abarnett Reply:


October 28th, 2009 at 11:23 am

521 is the port number to the FastCGI server. The FastCGI protocol creates a server that can be connected to by LightTPD, so to answer your question, just go to http://localhost. [Reply]

Kristian J.
October 28th, 2009 at 4:41 am Great guide seems to be working fine on my XP box. The only change I had to do was to add extension_dir to php.ini-development: extension_dir = C:\Web\php\ext Now on to find a Windows binary for APC [Reply]

Sam K
November 7th, 2009 at 12:50 pm Also added the extension_dir as above, but cant start lightpd using this kit. Windows 7 I get the following error: C:\Web>LightTPD\LightTPD.exe -f LightTPD\conf\lighttpd-srv.conf -m LightTPD\lib 2009-11-07 08:48:04: (configfile.c.808) source: LightTPD\conf\lighttpd-srv.conf line: 1 pos: 1 invalid character in variable name 2009-11-07 08:48:04: (configfile.c.864) configfile parser failed at: Bad compilation? [Reply]

abarnett
November 7th, 2009 at 2:58 pm Sam, the lighttpd-srv.conf file is an aggregate for other configuration files, so make sure that the file paths in there are accurate. [Reply]

Leandro
May 3rd, 2010 at 12:59 am Hi, I have a problem on win 7 and XP both with fastcgi. I can run just ONE php script at once. I mean, if i run one php script, and at the same time i want to run another one, the first one has to end so the second can begin. I think its a multithread problem on fastcgi, but i dont know how to fix it and i searched on google and noone has the same error as me. Abarnett, can you do me a favor? Could you upload your hole Web directory? Thank you! [Reply] abarnett Reply:
July 7th, 2010 at 11:12 am

bragilabs.com//running-lighttpd-my

3/5

17/03/2011

Running LightTPD, MySQL, and PHP o

Leandro, fastcgi is not a multithreaded protocol, but you can make it multithreaded by running several instances of the php-cgi server bound to different ports. Go here and scroll to the Load-Balancing section. [Reply]

Patrick
November 5th, 2010 at 9:18 pm Sweet post! GREAT! [Reply]

Water Cooler
January 28th, 2011 at 3:46 am `` I am very thankful to this topic because it really gives useful information ,~, [Reply]

Ibzan
January 31st, 2011 at 10:06 am hello. hey when i open a page of my server.. it open a msdos(command line windows) of lighttpd. it happen when i open i page i have windows 7 home premium. hstart didnt work?. there is a solution no not show a windows everytime i open a page. thanks [Reply] abarnett Reply:
February 2nd, 2011 at 6:19 pm

Make sure youre using the option /NOCONSOLE on hstart [Reply]

cmenow
February 25th, 2011 at 10:23 pm hi there, how to configure phpmyadmin to work with this setup? thanks. [Reply] abarnett Reply:
February 26th, 2011 at 3:59 am

Have phpmyadmin refer to localhost:mysqlportnum. For the user choose root, and leave the pass word blank. MySQL will not reject root accounts when connected from the host. [Reply] cmenow Reply:
February 26th, 2011 at 4:01 pm

@abarnett, thanks for quick response. do u care to elaborate the steps on how to do this [Have phpmyadmin refer to localhost:mysqlportnum.]? just so u know, my install is running good, verified. the only different is that i have it on D:\ instead of C:\ drive. phpmyadmin dir is in D:\Docs.
bragilabs.com//running-lighttpd-my 4/5

17/03/2011

Running LightTPD, MySQL, and PHP o

Heres the error i get when accessing localhost/phpmyadmin Cannot load mysql extension. Please check your PHP configuration. i appreciate any input on this. thanks again. [Reply]

Cancel

bragilabs.com//running-lighttpd-my

5/5

Вам также может понравиться