Home php教程 php手册 LNMP(PHP扩展)+miedawiki

LNMP(PHP扩展)+miedawiki

Jun 06, 2016 pm 07:53 PM
fast lnmp php Expand designation

指定FastCGI要用FPM PHP要求扩展mysql,mysqli,ldap,Xcache 1. 安装 PHP 5.3.3 或更高的版本; 2. 安装 MySQL 5.0.51 或更高的版本; 3. 安装 Nginx 1.4.2 或更高的版本; 4. mediawiki 1.21.1 5. Jdk 1.6.10 所有安装包都在我的资源共享里可以找到(写完这个

指定FastCGI要用FPM

PHP要求扩展mysql,mysqli,ldap,Xcache

1.  安装PHP5.3.3或更高的版本;

2.  安装MySQL5.0.51或更高的版本;

3.  安装Nginx1.4.2或更高的版本;

4. mediawiki 1.21.1 

5. Jdk1.6.10
所有安装包都在我的资源共享里可以找到(写完这个之前,应该找不到- -!)

PHP5.3.3之后自带了FPM,可以省点事

由于有版本需求,只能编译安装了


Nginx安装部分

在安装系统时候安装了gcc,openssl-devel,zlib-devel,所以只需要把pcre-devel装上就成了

1.安装Nginx所需pcre库

tar -zxvf pcre-8.02.tar.gz

cd pcre-8.02

./configure

make

make install


2.安装Nginx

tar -zxvf nginx-1.4.2.tar.gz

cd nginx-1.4.2

./configure --prefix=/usr/local/nginx               "这步如果有需要可以选择添加一些可选参数,不做赘述"

make

make install


3.访问IP或者域名

看到nginx欢迎你了,就算成功了



由于php在编译时需要加入mysql扩展的参数,需要指定mysql相关路径,故此需要先安装mysql

mysql之前没源码安装过,都是二进制装的

但是这次这个版本实在找不到二进制了,临时参考了好多文档,东拼西凑,凑出来一个成功的

公司mysql字符集全部是utf-8,不知道使用部门有没有需要,直接加上,省的以后麻烦

mysql安装部分

建立mysql组和用户

gourpadd mysql

useradd -g mysql mysql

安装mysql

tar -zxvf mysql-5.0.51.tar.gz

cd mysql-5.0.51

./configure --prefix=/usr/local/mysql --with-charset=utf8

make

make install

将mysql的配置文件cp到/etc目录下

cp support-files/my-medium.cnf /etc/my.cnf

设置mysql启动

cp -r support-files/mysql.server /etc/init.d/mysqld

/sbin/chkconfig --add mysqld

这样以后就可以对mysql的启停用service操作,与输入一串路径比方便很多

给mysql路径用户和组权限

chown -R mysql:mysql /usr/local/mysql

/usr/local/mysql/bin/mysql_install_db --user=mysql

启动

service mysqld start

将mysql命令加入环境变量

export PATH=/usr/local/mysql/bin:$PATH

/usr/local/mysql/bin/mysql_secure_installation

首次登录无密码,直接登

mysql -uroot


PHP安装

所需依赖gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel


tar -zxvf php-5.3.3.tar.gz

cd php-5.3.3

./configure --prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir--with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml--disable-rpath --enable-discard-path --enable-safe-mode--enable-bcmath --enable-shmop --enable-sysvsem--enable-inline-optimization --with-curl --with-curlwrappers--enable-mbregex --enable-fpm --enable-sockets --enable-fastcgi --enable-force-cgi-redirect--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf--with-openssl --with-mhash --enable-pcntl--with-ldap--with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap--enable-ftp --enable-mbregex --with-charset=utf8

configure这部视自身情况删减,加粗部分为我这次的必选项,我安装时候是整个贴上去的,因为写这个文档之前,请求部门说只要一个LNMP环境+wiki系统就成,结果过了几天告诉我又要扩展返工,说的好像是我的问题一样,当初不说清楚......省略。他们让我重新编译一次php,所以这次我是把php单独重新编译的,一气之下,全给他们丫的兑上了,管他们用不用呢

如果报错,网上找找,普遍是缺关联,直接yum装上就解决了

继续

make

make install

配置PHP

cp php.ini-development /usr/local/php/lib/php.ini

cd /usr/local/php/etc

cp php-fpm.conf.default php-fpm.conf

vi php-fpm.conf

编辑php-fpm.conf,修改如下内容(将注释删除)
[global]

pid =/usr/local/php/var/run/php-fpm.pid
error_log =/usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = 127.0.0.1:9000
user = yaoya
group = yaoya
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35

启动php-fpm

/usr/local/php/sbin/php-fpm

ps -ef | grep php-fpm

netstat -ntlp

确认进程和9000端口是否存在

修改nginx.conf使其支持php解析

增加一个虚拟主机

location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

#这点要指向自己的页面路径,如果解析是空白对比nginx和php日志调吧
include fastcgi_params;
}

然后重启nginx

可以看到正确解析phpinfo后,php扩展了mysql,mysqli,ldap

Xcache这个需要自己安装,然后配置

步骤如下

wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz

tar -zxvf xcache-1.3.0.tar.gz

cd xcache-1.3.0

./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config

make

make install

之后会看到 Installing shared extensions:  给了一个路径,复制下来,之后配置extensions路径时用到它

之后直接把xcache-1.3.0这个目录下的xcache.ini文件内容粘到php.ini里边

在command段内找到zend-extension=

原先内容和之前安装后给出的路径差不多,但是zts后是xxxxx,把那个路径粘上去

然后愉快的把nginx和php-fpm重启


jdk装完,配个环境变量就好了

wiki直接代码弄上去就哦了

这两个很简单

Statement of this Website
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

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 Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles