赞
踩
目录
1.进入到/usr/local/下,下载php的安装包(php的下载网址)
5.编辑虚拟机hosts,能让其访问到www.php.com页面
12.登陆mysql,输入mysql -uroot -p,之后回车
这个我在前面写过,具体请看:
cd /usr/local/
wget https://www.php.net/distributions/php-7.4.6.tar.gz
tar -zxvf php-7.4.6.tar.gz
cd php-7.4.6
yum install -y libxml2 libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libzip-devel oniguruma-devel sqlite-devel
./configure --prefix=/usr/local/php74 --with-config-file-path=/etc/php74 --with-fpm-user=nginx --with-fpm-group=nginx --enable-fpm --enable-opcache --enable-inline-optimization --disable-debug --disable-rpath --enable-shared -enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --enable-gd --enable-gd-jis-conv --with-jpeg --with-freetype --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --enable-soap --with-gettext --enable-fileinfo --with-pear --enable-maintainer-zts --with-ldap=shared --without-gdbm --with-zip
make && make install
vim /etc/profile
PATH=$PATH:/usr/local/php74/bin #我这里的目录是php74注意别写错
source /etc/profile
# 此时执行
php -v #即可看到php信息
cp /usr/local/php-7.4.16/php.ini-production /usr/local/php74/php.ini
vim /usr/local/php74/php.ini
display_errors = On //原来是off
cd /usr/local/php74/etc
cp php-fpm.conf.default php-fpm.conf
vim php.fpm.conf
去掉pid=run/php-fpm.pid前面的分号
cd ./php-fpm.d
cp www.conf.default www.conf
cd /usr/local/php74/sbin/
./php-fpm
cd /usr/local/php-7.4.16/sapi/fpm
cp init.d.php-fpm /etc/init.d/php-fpm
#赋予脚本可执行命令,添加开机自启动
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
systemctl restart php-fpm.service
systemctl status php-fpm.service
vim /usr/local/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;server {
listen 80;
server_name localhost;location / {
root html;
index index.html index.htm;}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}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;
}}
server {
listen 80;
server_name www.php.com;location / {
root /usr/local/nginx/html/php;
index index.html index.htm index.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; include fastcgi_params;
}}
# ip 100
server {
listen 80;
server_name 192.168.191.100;
location / {
root /usr/local/nginx/html/ip/100;
index index.html;
}
}# ip 200
server {
listen 80;
server_name 192.168.191.200;
location / {
root /usr/local/nginx/html/ip/200;
index index.html;
}
}# port 100
server {
listen 100;
server_name 192.168.191.129;
location / {
root /usr/local/nginx/html/port/100;
index index.html;
}
}
# port 200
server {
listen 200;
server_name 192.168.191.129;
location / {
root /usr/local/nginx/html/port/200;
index index.html;
}
}
# www.jiege.com
server {
listen 80;
server_name www.jiege.com;
location / {
root /usr/local/nginx/html/name/jiege;
index index.html;
}
}}
cd /usr/local/nginx/html/php/
vim index.php
<?php
phpinfo();
?>
vim /etc/hosts
192.168.191.129 www.php.com
C:\Windows\System32\drivers\etc
192.168.191.129 www.php.com
cd /usr/local/nginx/sbin/
./nginx
cd /usr/local/php/sbin/
./php-fpm
killall php-fpm
rpm -qa|grep php
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"
yum module disable mysql
yum install mysql-community-server --nogpgcheck
systemctl restart mysqld.service
systemctl restart mysqld.service
vim /etc/my.cnf
[mysqld]
skip-grant-tables
systemctl restart mysqld
mysql -uroot -p
use mysql
update user set password=password('root') where user='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION;
flush privileges;
exit
# skip-grant-tables
systemctl restart mysqld.service
mysql -uroot -proot
别问我怎么做出来的,两天时间,边排错边配置,头大,你们自己看着自己弄吧,由于配置的时候经常有些问题,不过我都给你们解决了,所以我就不粘图片了,你们自己加油。按照我的走绝对没问题。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。