lighttpd+mysql+php
博客已经搬家,请访问如下地址: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

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

JWT是一种基于JSON的开放标准,用于在各方之间安全地传输信息,主要用于身份验证和信息交换。1.JWT由Header、Payload和Signature三部分组成。2.JWT的工作原理包括生成JWT、验证JWT和解析Payload三个步骤。3.在PHP中使用JWT进行身份验证时,可以生成和验证JWT,并在高级用法中包含用户角色和权限信息。4.常见错误包括签名验证失败、令牌过期和Payload过大,调试技巧包括使用调试工具和日志记录。5.性能优化和最佳实践包括使用合适的签名算法、合理设置有效期、

文章讨论了PHP 5.3中引入的PHP中的晚期静态结合(LSB),从而允许静态方法的运行时分辨率调用以获得更灵活的继承。 LSB的实用应用和潜在的触摸

SOLID原则在PHP开发中的应用包括:1.单一职责原则(SRP):每个类只负责一个功能。2.开闭原则(OCP):通过扩展而非修改实现变化。3.里氏替换原则(LSP):子类可替换基类而不影响程序正确性。4.接口隔离原则(ISP):使用细粒度接口避免依赖不使用的方法。5.依赖倒置原则(DIP):高低层次模块都依赖于抽象,通过依赖注入实现。

使用PHP的cURL库发送JSON数据在PHP开发中,经常需要与外部API进行交互,其中一种常见的方式是使用cURL库发送POST�...

如何在系统重启后自动设置unixsocket的权限每次系统重启后,我们都需要执行以下命令来修改unixsocket的权限:sudo...
