记一笔:cent os6.7安装PHP7 MYSQL

/ 5评 / 0

****配置好编译环境


yum update && yum upgrade
yum groupinstall "Development Tools"
yum install gcc gcc-c++ pcre* openssl* gd-devel* zlib-devel pcre-devel libxml2-devel curl-devel

下载安装libmcrypt

地址:http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/ (具体下载地址需点进去获得,如http://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz )

编译安装即可

tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install

编辑 /etc/ld.so.conf 末行添加读取

vi /etc/ld.so.conf
/usr/local/lib

并执行:ldconfig

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install php70w php70w-opcache

下载PHP7并解压

wget http://cn2.php.net/distributions/php-7.0.1.tar.gz
tar zxvf php-7.0.1.tar.gz

配置编译参数

cd php-7.0.1
./configure \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--bindir=/usr/local/php7/bin \
--sbindir=/usr/local/php7/sbin \
--includedir=/usr/local/php7/include \
--libdir=/usr/local/php7/lib/php \
--mandir=/usr/local/php7/php/man \
--with-config-file-path=/usr/local/php7/etc \
--with-mcrypt=/usr/include \
--with-mhash \
--with-openssl \
--with-mysqli=shared,mysqlnd \
--with-pdo-mysql=shared,mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-zip \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--enable-opcache \
--enable-fpm \
--without-gdbm \
--disable-fileinfo

如果没有错误,会出现License信息

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

编译安装

make && make install

配置文件

cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

启动

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

编译完成信息

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/
Installing PHP CLI binary:        /usr/local/php7/bin/
Installing PHP CLI man page:      /usr/local/php7/php/man/man1/
Installing PHP FPM binary:        /usr/local/php7/sbin/
Installing PHP FPM config:        /usr/local/php7/etc/
Installing PHP FPM man page:      /usr/local/php7/php/man/man8/
Installing PHP FPM status page:      /usr/local/php7/php/php/fpm/
Installing phpdbg binary:         /usr/local/php7/bin/
Installing phpdbg man page:       /usr/local/php7/php/man/man1/
Installing PHP CGI binary:        /usr/local/php7/bin/
Installing PHP CGI man page:      /usr/local/php7/php/man/man1/
Installing build environment:     /usr/local/php7/lib/php/build/
Installing header files:          /usr/local/php7/include/php/
Installing helper programs:       /usr/local/php7/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php7/php/man/man1/
  page: phpize.1
  page: php-config.1
/root/php-7.0.1/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin
ln -s -f phar.phar /usr/local/php7/bin/phar
Installing PDO headers:          /usr/local/php7/include/php/ext/pdo/

来源[http://www.cnblogs.com/imzye/p/5109770.html][1]

安装mysql

默认使用centos yum安装的mysql不是5.5版本的,我们需要增加两个新的repo

rpm -Uvh http://mirror.steadfast.net/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

centos6下php php-fpm的yum安装 查看一下是不是有mysql 5.5了

yum --enablerepo=remi,remi-test list mysql mysql-server

安装mysql5.5

yum --enablerepo=remi,remi-test install mysql mysql-server

启动mysql5.5

/etc/init.d/mysqld start

设置开机启动

chkconfig --levels 345 mysqld on

要启用MySQL 安全设置请输入以下命令

/usr/bin/mysql_secure_installation

php composer.phar install时报错如

Problem 1

- Installation request for gregwar/captcha v1.1.1 -> satisfiable by gregwar/captcha[v1.1.1].

- gregwar/captcha v1.1.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.

Problem 2

- Installation request for guzzle/guzzle v3.9.3 -> satisfiable by guzzle/guzzle[v3.9.3].

- guzzle/guzzle v3.9.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.

解决方法: 通过apt-cache search php5|grep gd(最后是包的名字,例如curl, mbstring),找到相应的php版本对应的包名字,然后通过apt-get install php7.0-gd(curl,mbstring)安装。注意带有dom字段的,一般是php7.0-xml这个包。

配置 supervisor

安装 supervisor

$ easy_install supervisor

初始化 supervisor 配置文件

$ echo_supervisord_conf > /etc/supervisord.conf

配置 supervisor

[program:manyuser] command = python /root/* user = root
autostart = true
autorestart = true command就是ss的运行命令; user是执行命令的用户; autostart和autoresart指自动启动和自动重启 运行 supervisor

运行的时候使用-c指定配置文件 supervisord -c /etc/supervisord.conf 如果不指定配置文件 supervisord

则配置文件会依次在下面的文件夹中寻找 $CWD/supervisord.conf $CWD/etc/supervisord.conf

/etc/supervisord.conf

更新配置文件

$ supervisorctl update //更新配置文件 $ killall -HUP supervisord //重启 supervisor 服务以加载配置

把 supervisor 加入开机启动进程

$ vi /etc/rc.local

supervisord -c /etc/supervisord.conf 或 supervisord 查看系统进程

查看全部进程:$ ps -ef 通过过滤关键词查看进程:$ ps -ef | grep keyword

锐速破解版安装方法:

wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/serverspeeder/master/serverspeeder-all.sh && bash serverspeeder-all.sh

如果忘记了MySQL的root密码,可以用以下方法重新设置:

  1. KILL掉系统里的MySQL进程;service mysqld stop
  2. 用以下命令启动MySQL,以不检查权限的方式启动;
    mysqld_safe --skip-grant-tables &
    
  3. 然后用空密码方式使用root用户登录 MySQL;
    mysql -u root
    
  4. 修改root用户的密码;
    mysql> update mysql.user set password=PASSWORD('**your new password**') where User='root'; 
    mysql> flush privileges; 
    mysql> quit 
    

重新启动MySQL,就可以使用新密码登录了

centos 6.x 用yum 安装php5.6

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 -y
yum install php56w-fpm -y

redis

启动

/usr/local/bin/redis-server /etc/redis/redis.conf

<strong>FTP安装后用户无法登陆</strong>

[root@ zhaiqutianshangxing vsftpd]# setsebool allow_ftpd_full_access 1
[root@ zhaiqutianshangxing vsftpd]# setsebool allow_ftpd_use_cifs 1
[root@ zhaiqutianshangxing vsftpd]# setsebool allow_ftpd_use_nfs 1
[root@ zhaiqutianshangxing vsftpd]# setsebool -P ftp_home_dir 1
[root@ zhaiqutianshangxing vsftpd]# setsebool httpd_enable_ftp_server 1
[root@ zhaiqutianshangxing vsftpd]# setsebool tftp_anon_write 1
[root@ zhaiqutianshangxing vsftpd]# service vsftpd restart
关闭 vsftpd:[确定]
为 vsftpd 启动 vsftpd:[确定]
[root@ zhaiqutianshangxing vsftpd]# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> on
allow_ftpd_use_cifs --> on
allow_ftpd_use_nfs --> on
ftp_home_dir --> on
ftpd_connect_db --> off
httpd_enable_ftp_server --> on
sftpd_anon_write --> off
sftpd_enable_homedirs --> off
sftpd_full_access --> off
sftpd_write_ssh_home --> off
tftp_anon_write --> on

重启vsftpd

 

5 responses to “记一笔:cent os6.7安装PHP7 MYSQL”

  1. Anonymous says:

    测试评论

  2. 流氓肚 says:

    野兽~吾来撒侬类~

Leave a Reply

Your email address will not be published.