php开发环境搭建命令集

openresty+php7.4+mysql8.0


yum install -y yum-utils device-mapper-persistent-data lvm2 gcc gcc-c++

yum install readline-devel pcre-devel openssl-devel

cd ~

wget https://openresty.org/download/openresty-1.15.8.2.tar.gz

tar zxvf openresty-1.15.8.2.tar.gz

cd openresty-1.15.8.2

./configure --prefix=/usr/local/openresty

make

make install

groupadd www

useradd -g www www -s /sbin/nologin

sed -i "s/#user nobody;/user www www;/g" /usr/local/openresty/nginx/conf/nginx.conf

/usr/local/openresty/nginx/sbin/nginx

vi /lib/systemd/system/nginx.service

[Unit]

Description=nginx service

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/openresty/nginx/sbin/nginx

ExecReload=/usr/local/openresty/nginx/sbin/nginx -s reload

ExecStop=/usr/local/openresty/nginx/sbin/nginx -s quit

quitPrivateTmp=true

[Install]

WantedBy=multi-user.target

systemctl enable nginx

https://www.php.net/distributions/php-7.4.1.tar.gz

tar -zxvf php-7.4.1.tar.gz

cd php-7.4.1

rpm -ivh http://packages.psychotic.ninja/7/plus/x86_64/RPMS//libzip-0.11.2-6.el7.psychotic.x86_64.rpm

rpm -ivh http://packages.psychotic.ninja/7/plus/x86_64/RPMS//libzip-devel-0.11.2-6.el7.psychotic.x86_64.rpm

yum install libxml2 libxml2-devel curl-devel sqlite-devel libxslt libxslt-devel

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm


./configure --prefix=/usr/local/php7.4  --with-pdo-mysql -with-mysqli --with-zlib  --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring   --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --with-iconv --enable-gd --with-jpeg

cp /usr/local/php7.4/bin/php /usr/local/bin/

/lib/systemd/system/php-fpm.service


[Unit]

Description=php-fpm

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/php7.4/sbin/php-fpm

PrivateTmp=true

[Install]

WantedBy=multi-user.target

systemctl enable php-fpm.service

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

cp ~/php-7.4.1/php.ini-production /usr/local/php7.4/lib/php.ini

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

service php-fpm start

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.18-el7-x86_64.tar.gz

tar zxvf   mysql-8.0.18-el7-x86_64.tar.gz

mv mysql-8.0.18-el7-x86_64 /usr/local/mysql

cd /usr/local/mysql/

groupadd mysql

useradd -g mysql mysql -s /sbin/nologin

chown -R mysql:mysql ./

yum install libaio-devel

bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data(记录初始root账户密码)

vi /etc/my.cnf

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

socket=/usr/local/mysql/data/mysql.sock

vi /etc/profile

MYSQL_HOME=/usr/local/mysql

export MYSQL_HOME

export PATH=$PATH:$MYSQL_HOME/lib:$MYSQL_HOME/bin:$GOROOT/bin

source /etc/profile

vi /lib/systemd/system/mysql.service

[Unit]

Description=MySQL Server

After=network.target

After=syslog.target

[Service]

User=mysql

Group=mysql

ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf

LimitNOFILE = 5000

[Install]

WantedBy=multi-user.target

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

chmod +x /etc/init.d/mysql

chkconfig --add mysql

mkdir -p /var/log/mariadb/

touch /var/log/mariadb/mariadb.log

chown -R mysql:mysql /var/log/mariadb/mariadb.log

chmod -R 766 /usr/local/mysql/data

service mysql start

ln -s /usr/local/mysql/data/mysql.sock /tmp/mysql.sock

mysql -uroot -p

ALTER USER root@localhost IDENTIFIED BY 'DB@mysql!123';

create user 'root'@'%' identified by "密码";

grant all privileges on *.* to root@"%" with grant option;

quit

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容