Installation configuration record of Lighttpd + PHP

Source: Internet
Author: User

1. Download Lighttpd, PCRE, PHP, and other related extension packages
2. Install PCRE
./configure & make install

install PHP
. /configure -- prefix =/usr/local/PHP/-- With-mysql =/usr/local/MySQL -- With-Gd =/usr/local/GD -- With-libxml-Dir -- With-zlib =/usr/local/zlib -- With-curl -- With-libxml-Dir =/usr/local/libxml -- enable-EXIF -- enable-soap -- enable-sockets -- With-JPEG-Dir =/usr/local/JPEG -- With-PNG-Dir =/usr/local/PNG -- With-TTF -- With-FreeType-Dir =/usr/ local/FreeType -- With-ming =/usr/local/Libing -- enable-sqlite-utf8 -- With-XSL =/usr/local/libxslt -- enable-Zend-multibyte -- enable-shared -- enable- mbstring -- enable-Zend-multibyte -- With-XMLRPC -- enable-FastCGI -- enable-force-CGI-redirect
note:
extended -- enable-FastCGI -- enable-force-CGI-redirect will be generated (bin/PHP-CGI execution file)
do not bring -- with-apxs2 =/usr/local/apache2/bin/apxs (after the installation, the PHP Execution file is in CLI mode)

# Make & make install

Install Lighttpd

./Configure -- prefix =/usr/local/Lighttpd & make install

3. Create or copy the Lighttpd. conf STARTUP configuration file
Switch to the root directory/doc of the source code package
# Cp Lighttpd. CONF/usr/local/Lighttpd. conf

Start the Lighttpd method:
#/Usr/local/Lighttpd/sbin/Lighttpd-F/usr/local/Lighttpd. conf

The installation is successful, and you can access it normally!

4. Configure as System Service
Switch to/usr/local/Lighttpd/sbin at each start and execute./Lighttpd-F/usr/local/Lighttpd. conf is troublesome and cannot be restarted!

Switch to the root directory of the source code package:
# Cd Doc
# Cp sysconfig. Lighttpd/etc/sysconfg/Lighttpd
# Cat/etc/sysconfg/Lighttpd

The content is as follows: lighttpd_conf_path =/etc/Lighttpd. conf. modify it to the corresponding configuration file directory/usr/local/Lighttpd. conf.
# Cp RC. Lighttpd. RedHat/etc/init. d/Lighttpd
# Cat/etc/init. d/Lighttpd

Modify Lighttpd = "/usr/sbin/Lighttpd" to the installation directory/usr/lcoal/Lighttpd/sbin/Lighttpd.

You want to start Lighttpd when the server is started:
# Chkconfig Lighttpd on

Command operation: Service Lighttpd [command]: [Start | stop | restart | condrestart | reload | status]

5. Configure Lighttpd to support PHP, CGI, etc...

FastCGI. Server = (". php" =>
("Localhost" =>
(
"Socket" => "/tmp/php-fastcgi.socket ",
"Bin-path" => "/usr/local/PHP/bin/PHP-cgi"
)
)
)

6. Install spawn-fcgi and manage the FastCGI process.
#./Configure -- prefix =/usr/local/spawn-fcgi & make install


Go to the root directory of the Lighttpd source code package:
# Cd Doc
# Cp spawn-php.sh/usr/local/Lighttpd/spawn-php.sh

Modify content
# Absolute path to the spawn-fcgi binary
Spawnfcgi = "/usr/local/Lighttpd/bin/spawn-fcgi"

# Absolute path to the PHP binary
Fcgiprogram = "/usr/local/PHP/bin/PHP-cgi"

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.