centos7 php开发环境安装-php

PHP7.2 安装

1.创建运行用户

groupadd  www

useradd -g  www  www

2.建立软连接

cp -frp /usr/lib64/libldap*  /usr/lib/

ln -s /usr/local/lib/libiconv.so.2  /usr/lib64/

3.编译安装php

tar -zxvf php-7.2.4.tar.gz

cd php-7.2.4

./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--enable-fpm
--with-fpm-user=www
--with-fpm-group=www
--enable-mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
--enable-mysqlnd-compression-support
--with-iconv-dir
--with-freetype-dir
--with-jpeg-dir
--with-png-dir
--with-zlib
--with-libxml-dir
--enable-xml
--disable-rpath
--enable-bcmath
--enable-shmop
--enable-sysvsem
--enable-inline-optimization
--with-curl
--enable-mbregex
--enable-mbstring
--enable-intl
--with-libmbfl
--enable-ftp
--with-gd
--with-openssl
--with-mhash
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-zip
--enable-soap
--with-gettext
--disable-fileinfo
--enable-opcache
--with-pear
--enable-maintainer-zts
--with-ldap=shared
--without-gdbm
--with-apxs2=/usr/local/apache/bin/apxs

make -j4

如果编译出现错误使用这个编辑命令代替make ZEND_EXTRA_LIBS=‘-liconv‘

不要 make test 害死人等时间太长

make install

4.配置php配置文件

4.1 复制需要的配置文件:

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

cp /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.conf

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

4.2配置php.ini

expose_php = Off

short_open_tag = ON

max_execution_time = 300

max_input_time = 300

memory_limit = 128M

post_max_size = 32M

date.timezone = Asia/Shanghai

#mbstring.func_overload=2

extension = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/ldap.so"

[opcache]

zend_extension=/usr/local/php/lib/php/extensions/no-debug-zts-20160303/opcache.so

opcache.memory_consumption=128

opcache.interned_strings_buffer=8

opcache.max_accelerated_files=4000

opcache.revalidate_freq=60

opcache.fast_shutdown=1

opcache.enable_cli=1

disable_functions=passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru

4.3配置www.conf

取消以下注释并修改优化其参数:

listen = /var/run/www/php-cgi.sock

listen.owner = www

listen.group = www

listen.mode = 0660

listen.allowed_clients = 127.0.0.1

pm = dynamic

listen.backlog = -1

pm.max_children = 180

pm.start_servers = 50

pm.min_spare_servers = 50

pm.max_spare_servers = 180

request_terminate_timeout = 120

request_slowlog_timeout = 50

slowlog = var/log/slow.log

4.4创建php-cgi.sock存放目录

mkdir /var/run/www/

chown -R www:www /var/run/www

4.6配置php-fpm.conf

取下以下注释并填写完整路径:

pid = /usr/local/php/var/run/php-fpm.pid

4.7运行php-fpm

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

5.开机启动

5.1 启动文件  vim /etc/systemd/system/php-fpm.service

5.2 文件内容

[Unit]

Description=The PHP FastCGI Process Manager

After=syslog.target network.target

[Service]

Type=simple

PIDFile=/usr/local/php/var/run/php-fpm.pid

ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf

ExecReload=/bin/kill -USR2 $MAINPID

ExecStop=/bin/kill -SIGINT $MAINPID

[Install]

WantedBy=multi-user.target

5.3启动php-fpm

systemctl start php-fpm.service

5.4添加到开机启动

systemctl enable php-fpm.service

6.启动与关闭

systemctl enable php-fpm.service      #开机运行服务

systemctl disable php-fpm.service      #取消开机运行

systemctl start php-fpm.service        #启动服务

systemctl restart php-fpm.service       #重启服务

7.Php 加入环境变量

1.将 /usr/local/php/bin 加到后面,用:隔开

    vi /root/.bash_profile    

   PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/lcoal/php/bin

 2.重启

   source /root/.bash_profile 

原文地址:https://www.cnblogs.com/ddf128/p/12123885.html

时间: 2024-10-31 18:20:48

centos7 php开发环境安装-php的相关文章

centos7 php开发环境安装-Git

Git 的2中安装方法 1. yum命令安装: yum install -y git 2. 服务编译安装(推荐) 2.1 安装依赖包 yum install -y wget yum install -y gcc-c++ yum install -y zlib-devel perl-ExtUtils-MakeMaker 2.2 下载最新git cd /usr/local/src wget https://mirrors.edge.kernel.org/pub/software/scm/git/gi

centos7 php开发环境安装-mysql

MySQL安装 1.安装cmake(作为mysql的安装工具) tar -zxvf cmake-3.8.0.tar.gz cd cmake-3.8.0 ./bootstrap gmake gmake install 2.安装boost_1_59_0 tar -zxvf boost_1_59_0.tar.gz cd boost_1_59_0 ./bootstrap.sh ./b2 ./b2 install 3.创建用户.配置目录 添加mysql用户和所属组 /usr/sbin/groupadd m

centos7 php开发环境安装-Nginx

1.Nginx编译安装 tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2 ./configure --user=www --group=www --prefix=/usr/local/nginx/ --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module

centos7 php开发环境安装-composer

1.安装composer cd /usr/local/src curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer 2.Composer 使用 chmod -R 777 /usr/local/bin/composer (错误时修改权限) 3.切换国内镜像 composer config -g repo.packagist composer https://packagis

centos7 php开发环境安装--配置SSL(Apache为例)

1.检查是否安装OpenSSL 1.1 查看是否安装 openssl version 1.2 编译安装: https://www.cnblogs.com/rxbook/p/9367725.html 1.3  yum安装 yum install openssl yum install openssl-devel 1.4 在线升级 yum -y update openssl 2.配置证书上传目录 在Apache安装目录中新建cert目录,并将下载的Apache证书. 证书链文件和秘钥文件拷贝到cer

centos7 php开发环境安装(一)

准备工作 防火墙 systemctl status firewalld        看到active(running)就意味着防火墙打开了 systemctl stop firewalld          看到inactive(dead)就意味着防火墙关闭了 systemctl start firewalld          打开防火墙 systemctl disable firewalld        重启后防火墙还是处于关闭的状态 systemctl enable firewalld

三、安装cmake,安装resin ,tars服务,mysql 安装介绍,安装jdk,安装maven,c++ 开发环境安装

三.安装cmake,安装resin 2018年07月01日 21:32:05 youz1976 阅读数:308 开发环境说明: centos7.2 ,最低配置:1核cpu,2G内存,1M带宽 1.安装rz,sz命令,将安装包发送至服务器 yum install lrzsz 2.glibc-devel安装介绍如果没有安装glibc的开发库,需要先安装. yum install glibc-devel 3.安装gcc yum install gccyum install gcc-c++ 4.cmak

mac 开发环境安装使用 记录

---恢复内容开始--- 常用命令 1 查找文件位置: $locate php-fpm 软件变动的话更新locate本地库,可能比较耗时. $sudo /usr/libexec/locate.updatedb 2 查找运行文件位置 $whereis php-fpm $witch php-fpm 所有命令最好再超级管理员下运行,防止权限问题.要不然每次加sudo也很烦,另外安装是最好删除掉以前安装的软件 homebrew部分 是一个非常好的mac下的开发软件管理器.集安装卸载升级于一体.非常方便.

React Native 开发环境安装和配置使用报错: -bash: react-native: command not found

[React  Native 开发环境安装和配置:-bash: react-native: command not found 报错: 前提是安装homebrew,node.js ,npm ,watchman,flow都成功.React  Native 开发环境安装和配置 执行react-native init TestProject 命令 创建demo时报错:-bash: react-native: command not found 报错提示:Please include the follo