search

博客已经搬家,请访问如下地址:http://www.czhphp.com

一:安装mysql

下载:wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.1.33.zip

安装:

       unzip mysql-5.1.33.zip

       cd mysql-5.1.33.zip

      ./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase   
      make
      make install
      useradd mysql -d /data/mysql -s/sbin/nologin
      /usr/local/mysql/bin/mysql_install_db--user=mysql
     cd /usr/local/mysql
     chown -R root:mysql .
     mkdir -p /data/mysql/data
     chown -R mysql /data/mysql/data
     cp share/mysql/my-huge.cnf /etc/my.cnf
     cp share/mysql/mysql.server/etc/rc.d/init.d/mysqld
     chmod 755 /etc/rc.d/init.d/mysqld
     chkconfig --add mysql

     service mysqld start

 当重新启动时候总 报以下错误:

   ERROR! MySQL manager or server PID file could not be found!

   Starting MySQL. ERROR! Manager of pid-file quit without updating file.

解决办法:

   MySQL编译安装,初始化数据库的时候出现:
   unknown option '--skip-federated' 错误。

   #vi /etc/my.cnf
   #skip-federated 将此行注释掉即可。或者编译的时候加上如下参数:--with-plugins=all

   如果还是不行的话那么就是因为您在配置的时候没有添加datadir,

  #vi /etc/my.cnf

    添加以下语句:

    [mysqld]
    port            = 3306
    socket          = /tmp/mysql.sock
    datadir = /usr/local/mysql/data
    datadir是新加的

 

二、接着安装php

tar zxf php-5.2.4.tar.gz

cd php-5.2.4

./configure --prefix=/usr/local/php-fcgi --enable-fastcgi --enable-force-cgi-redirect --without-iconv --enable-mbstring --with-mysql=/usr/local/mysql

注意:php安装的过程中也许会报以下错误

collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1

解决办法:

请安装lib所需的安装包

yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel  pam-devel kernel

执行安装完以后即可解决问题

make

make install


复制参数文件到目标目录:

cp php.ini-dist /usr/local/php-fcgi/lib/php.ini

检查fast-cgi是否安装成功可以运行如下命令

/usr/local/php-fcgi/bin/php-cgi -v

显示如下信息,内容里包含“PHP 5.2.4 (cgi-fcgi)"表示支持fast-cgi了

PHP 5.2.4 (cgi-fcgi) (built: Oct 28 2007 20:08:41)

Copyright (c) 1997-2007 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies  

早就听说lighttpd加PHP的FAST-CGI方式性能不错,抽时间装了下.只是完成了环境的安装,还没具体看性能什么的!

以下是我装lighttpd+PHP(FAST-CGI)+mysql的,如有问题,请给我评论.

三、最后安装lighttpd

1.安装配置lighttpd

1.1 首先创建运行lighttpd的用户和组

# groupadd lighttpd

# useradd -g lighttpd -s /sbin/nologin -d /dev/null lighttpd

1.2 开始安装lighttpd

# wget http://www.lighttpd.net/download/lighttpd-1.4.8.tar.gz

# tar -zxvf lighttpd-1.4.8.tar.gz

# cd lighttpd-1.4.8

# ./configure --prefix=/usr/local/lighttpd

# make

# make install

# mkdir /usr/local/lighttpd/conf

# mkdir /usr/local/lighttpd/log

# mkdir /usr/local/lighttpd/htdocs

# mv ./doc/lighttpd.conf /usr/local/lighttpd/conf/

# cp ./doc/rc.lighttpd.redhat /etc/init.d/lighttpd

vi conf/lighttpd.conf

将 #”mod_fastcgi”, 的#去掉

 

server.modules              = (
                               "mod_rewrite",
                               "mod_redirect",
                               "mod_alias",
                                "mod_access",
                               "mod_cml",
                               "mod_trigger_b4_dl",
                               "mod_auth",
                               "mod_status",
                               "mod_setenv",
                               "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "/usr/local/lighttpd/htdocs/"

## where to send error-messages to
server.errorlog             = "/usr/local/lighttpd/log/lighttpd/error.log"

找到fastcgi的定义

#### fastcgi module

## read fastcgi.txt for more info

## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini

fastcgi.server = ( ".php" =>

                    ( "localhost" =>

                        ( "socket" => "/var/run/lighttpd/php-fastcgi.socket",

                          "bin-path" => "/usr/local/php-fcgi/bin/php-cgi" )

                     )

                  )

/var/run/lighttpd 该目录需要创建如果没有的话
一开始我把配置写"bin-path" => "/usr/local/php-fcgi/bin/php"这样,发现报错,后来改了下以上的配置,发现OK了!

启动lighttpd命令是这样的:

chown -R lighttpd:lighttpd /usr/local/lighttpd

service lighttpd restart

 

PHP FastCGI环境测试 --

  echo "" > /usr/local/lighttpd/htdocs/index.php

  curl http://127.0.0.1/index.php

 

大概的安装过程如上,有什么问题请大家多多指教,欢迎大家留下宝贵意见,谢谢。

博客已经搬家,请访问如下地址:http://www.czhphp.com

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Discover File Downloads in Laravel with Storage::downloadDiscover File Downloads in Laravel with Storage::downloadMar 06, 2025 am 02:22 AM

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

PHP Logging: Best Practices for PHP Log AnalysisPHP Logging: Best Practices for PHP Log AnalysisMar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Explain the concept of late static binding in PHP.Explain the concept of late static binding in PHP.Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

How to Register and Use Laravel Service ProvidersHow to Register and Use Laravel Service ProvidersMar 07, 2025 am 01:18 AM

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.