Centos 65 compile and install Nginx-1513+php-5510+Mysql-5537
http://www.cnblogs.com/whoamme/
Centos 6.5 Compile and install Nginx-1.5.13+php-5.5.10+Mysql-5.5.37
1. Configure the firewall and open port 80 and 3306
Copy the code
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
Add after the 22 port configuration
Copy the code
2. Turn off SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #Comment out
#SELINUXTYPE=targeted #Comment out
SELINUX=disabled #Add
Restart centos reboot -n
3. System agreement
Software source code package storage location:/usr/local/src
Source code package compilation and installation location:/usr/local/Software name
4. Download software
Download nginx (current stable version) http://nginx.org/download/nginx-1.5.13.tar.gz
Download pcre (supports nginx pseudo-static) http://sourceforge.net/projects/pcre/files/pcre/ 8.35/pcre-8.35.tar.gz
Download MySQL http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.37.tar.gz
Download php http://ar2.php.net/ get/php-5.5.10.tar.gz/from/this/mirror
Download cmake (MySQL compilation tool) http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
Download libmcrypt (PHPlibmcrypt module)
http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
5. Install compilation tools and library files ( Install using CentOS yum command)
yum install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog -ppl keyutils-libs-devel libcom_err-devel libsepol-devel
libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch mhash
6. Install cmake
tar zxvf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake
gmake install
7. Install mysql
Copy code
groupadd mysql #Add mysql group
useradd -g mysql mysql -s /bin/false #Create user mysql and join to mysql group, mysql users are not allowed to log in to the system directly
mkdir -p /data/mysql #Create the MySQL database storage directory
chown -R mysql:mysql /data/mysql #Set permissions
mkdir -p /usr/local/mysql #Create installation Directory
tar zxvf mysql-5.5.37.tar.gz
cd mysql-5.5.37
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSC #Configuration
make #Compile
make install #Install
cd /usr/local/mysql
cp ./support-files/my-huge.cnf /etc/my.cnf #Copy the configuration file (note: there is a my.cnf under the /etc directory by default, just overwrite it directly) Yes)
vi /etc/my.cnf #Edit the configuration file and add
datadir = /data/mysql in the [mysqld] section #Add the MySQL database path
./scripts/mysql_install_db --user=mysql #Generate the mysql system database
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #Add Mysql to system startup
chmod 755 /etc/init.d/mysqld #Increase execution permissions
chkconfig mysqld on #Add to boot Start
vi /etc/rc.d/init.d/mysqld #Edit
basedir = /usr/local/mysql #MySQL program installation path
datadir = /data/mysql #MySQl database storage directory
service mysqld start #Start
vi /etc/profile #Add the mysql service to the system environment variable: add the following line at the end
export PATH=$PATH:/usr/local/mysql/bin
The following two lines link the myslq library file to the system default location, so that you do not need to specify the library file address of mysql when compiling software such as PHP.
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
shutdown -r now #Need to restart the system, Wait for the system to restart and continue to operate under the terminal command line
mysql_secure_installation #Set Mysql password
Press Y according to the prompts and press Enter to enter the password twice
Or directly change the password /usr/local/mysql/bin/mysqladmin -u root -p password "123456" #Change password
service mysqld restart #Restart
Copy code
8. Install PCRE
Copy code
cd /usr/local/src
mkdir /usr/local/pcre
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make
make install
Copy code
9. Install nginx
Copy code
cd /usr/local/src
groupadd www
useradd -g www www -s /bin/false
tar zxvf nginx-1.5.13.tar.gz
cd nginx-1.5.13
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.35
make
make install
#Set nginx to start automatically, add the following script
vi /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local /nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_c/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog ="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${ NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running. ..."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock /subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
echo -n $"Reloading $prog: "
#kill - HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
; start
;;
stop)
Stop
RETVAL=$?
;;
*)
echo $"Usage: $prog {start| stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
chmod 775 /etc/rc.d/init.d/nginx
chkconfig nginx on
/etc/rc.d/init.d/nginx restart
service nginx restart
复制代码
10、安装libmcrypt
cd /usr/local/src
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
nake install
11、安装PHP
复制代码
cd /usr/local/src
tar -zvxf php-5.5.10.tar.gz
cd php-5.5.10
mkdir -p /usr/local/php5
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath
--enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap
--with-pear --with-gettext --enable-session --with-mcrypt --with-curl
make---------------------------------------------------------------------------------------------------------
make install
cp php.ini-production /usr/local/php5/etc/php.ini
rm -rf /etc/php.ini
ln -s /usr/local/php5/etc/php.ini /etc/php.ini
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf
vi /usr/local/php5/etc/php-fpm.conf
user = www #设置php-fpm运行账号为www
group = www #设置php-fpm运行组为www
pid = run/php-fpm.pid #取消前面的分号
cp /usr/local/src/php-5.5.10/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm#拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
vi /usr/local/php5/etc/php.ini #编辑配置文件
修改为:date.timezone = PRC #设置时区
复制代码
12、配置nginx支持php
复制代码
vi /usr/local/nginx/conf/nginx.conf #编辑配置文件,需做如下修改
user www www; #首行user去掉注释,修改Nginx运行组为www,www;必须与/usr/local/php5/etc/php-fpm.conf中的user,group配置相同,否则php运行出错
index index.php index.html index.htm; #添加index.php
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为
$document_root$fastcgi_script_name,或者使用绝对路径
/etc/init.d/nginx restart #重启nginx
复制代码
13、测试
复制代码
cd /usr/local/nginx/html/ #进入nginx默认网站根目录
rm -rf /usr/local/nginx/html/* #删除默认测试页
vi index.php #编辑
phpinfo();
chown www.www /usr/local/nginx/html/ -R #设置目录所有者
chmod 700 /usr/local/nginx/html/ -R #设置目录权限
shutdown -r now #重启系统
复制代码
14、相关命令
service nginx restart #重启nginx
service mysqld restart #重启mysql
/usr/local/php5/sbin/php-fpm #启动php-fpm
/etc/rc.d/init.d/php-fpm restart #重启php-fpm
/etc/rc.d/init.d/php-fpm stop #停止php-fpm
问题:
在Linux下安装PHP过程中,编译时出现configure: error: libjpeg.(a|so) not found 错误的解决办法
检查之后发现已经安装了libjpeg,但是在/usr/lib目录下没有libjpeg.so这个文件,在/usr/lib64下是有的,虽然使用–with-jpeg-dir=/usr/lib64 依然无效,最后用
[root@ www.linuxidc.com ~]#ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
问题解决, libpng 报的错误解决方法一样
以上就介绍了Centos 65 编译安装Nginx-1513+php-5510+Mysql-5537,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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.

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor