Closed banditsmile closed 2 years ago
补充一下,重新安装php7.4参考的文章:https://www.cnblogs.com/chenppp/p/13388748.html 除了修改安装目录,安装之后手动cp了php-fpm的配置文件,并且修改php-fpm.conf里面的user和监听端口,其他没做改动
[root@VM-0-17-centos ~]# systemctl start docker
[root@VM-0-17-centos ~]# docker pull 2233466866/lnmp
Using default tag: latest
latest: Pulling from 2233466866/lnmp
2d473b07cdd5: Pull complete
0da72e398a8e: Pull complete
09f939a707c0: Pull complete
Digest: sha256:833ce59f2464a25586b17df02677e164ff0eac233287a7f8af91f7fee65c9868
Status: Downloaded newer image for 2233466866/lnmp:latest
docker.io/2233466866/lnmp:latest
[root@VM-0-17-centos ~]# docker run -dit --privileged=true --name=lnmp 2233466866/lnmp
15585ff19b9a2e0f89d9ac8f119715be2b272f4b12e1e2e32f693ea5c586ab87
[root@VM-0-17-centos ~]# docker exec -it lnmp bash
[root@15585ff19b9a /]# ps aux|grep php
root 85 0.0 0.3 229392 5676 ? Ss 09:16 0:00 php-fpm: master process (/usr/local/php7/etc/php-fpm.conf)
www 86 0.0 0.2 229392 5384 ? S 09:16 0:00 php-fpm: pool www
www 87 0.0 0.2 229392 5384 ? S 09:16 0:00 php-fpm: pool www
www 88 0.0 0.2 229392 5384 ? S 09:16 0:00 php-fpm: pool www
root 142 0.0 0.0 10692 976 pts/1 S+ 09:16 0:00 grep --color=auto php
[root@15585ff19b9a /]# ps aux|grep nginx
root 46 0.0 0.0 19072 700 ? Ss 09:16 0:00 nginx: master process /usr/local/nginx/sbin/nginx
www 47 0.0 2.2 60684 42560 ? S 09:16 0:00 nginx: worker process
root 144 0.0 0.0 10692 972 pts/1 S+ 09:16 0:00 grep --color=auto nginx
[root@15585ff19b9a /]# ps aux|grep mysql
mysql 95 1.1 9.1 1131436 172300 ? Sl 09:16 0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root 146 0.0 0.0 10692 976 pts/1 S+ 09:16 0:00 grep --color=auto mysql
[root@15585ff19b9a /]# mysql_in
mysql_init mysql_install_db
[root@15585ff19b9a /]# mysql_init
spawn mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new password: The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root.
Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-enter new password:
Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : n
... skipping.
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Dropping test database... Success.
Removing privileges on test database... Success.
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success.
All done!
@2233466866 你上面的回复是要回复那个mysql的问题吧
先写结论:里面两个版本的php-fpm都有问题,最后重新从官网下载7.4版本的,编译安装之后才正常
过程 1.在nginx.conf添加了一行,允许创建多个虚拟主机
include /usr/local/nginx/conf/vhost/*.conf;
2.创建/usr/local/nginx/conf/vhost目录并添加虚拟主机配置如下 `server { listen 80; server_name aa.xxx.cn bb.xxx.cn;} `
3.创建/www/aa.xxx.cn/目录 chown -R www:www /www/aa.xxx.cn chmod -R 0755 /www/aa.xxx.cn
4.访问html文件正常,访问任何php文件都提示PHP Warning: Unknown: failed to open stream 检查了,访问的目录和文件都存在的,owner都是www,权限无论全局0755还是0777都无效,一直提示这个
5.strace跟踪进程返回内容如下:
{sa_family=AF_INET, sin_port=htons(43606), sin_addr=inet_addr("127.0.0.1")}, [112->16]) = 3 times({tms_utime=0, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 508452285 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}]) read(3, "\1\1\0\1\0\10\0\0", 8) = 8 read(3, "\0\1\0\0\0\0\0\0", 8) = 8 read(3, "\1\4\0\1\4\206\2\0", 8) = 8 read(3, "\17&SCRIPT_FILENAME/www/aa.xxx.cn/public/index.php\t\0PATH_INFO\17\34PATH_TRANSLATED/www/aa.xxx.cn/public\f\0QUERY_STRING\16\3REQUEST_METHODGET\f\0CONTENT_TYPE\16\0CONTENT_LENGTH\v\nSCRIPT_NAME/index.php\v\nREQUEST_URI/index.php\f\nDOCUMENT_URI/index.php\r\34DOCUMENT_ROOT/www/aa.xxx.cn/public\17\10SERVER_PROTOCOLHTTP/1.1\16\4REQUEST_SCHEMEhttp\21\7GATEWAY_INTERFACECGI/1.1\17\fSERVER_SOFTWAREnginx/1.19.4\v\nREMOTE_ADDR172.17.0.1\v\5REMOTE_PORT60310\v\nSERVER_ADDR172.17.0.3\v\2SERVER_PORT80\v\20SERVER_NAMEaa.xxx.cn\17\3REDIRECT_STATUS200\t\20HTTP_HOSTdiag4.golodev.cn\17\nHTTP_CONNECTIONkeep-alive\22\tHTTP_CACHE_CONTROLmax-age=0\36\1HTTP_UPGRADE_INSECURE_REQUESTS1\17sHTTP_USER_AGENTMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36\v\200\0\0\207HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\24\rHTTP_ACCEPT_ENCODINGgzip, deflate\24#HTTP_ACCEPT_LANGUAGEzh-CN,zh;q=0.9,en-US;q=0.8,en"..., 1160) = 1160 read(3, "\1\4\0\1\0\0\0\0", 8) = 8 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=60, tv_usec=0}}, NULL) = 0 rt_sigaction(SIGPROF, {sa_handler=0x71ded0, sa_mask=[PROF], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f5d08320400}, {sa_handler=0x71ded0, sa_mask=[PROF], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f5d08320400}, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0 lstat("/www/aa.xxx.cn/public", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/www/aa.xxx.cn", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/www", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0 open("/www/aa.xxx.cn/public", O_RDONLY) = 4 fstat(4, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 close(4) = 0 write(2, "NOTICE: PHP message: PHP Warning: Unknown: failed to open stream: Success in Unknown on line 0\n", 96) = 96 write(2, "ERROR: Unable to open primary script: /www/aa.xxx.cn/public (Success)\n", 77) = 77 times({tms_utime=0, tms_stime=0, tms_cutime=0, tms_cstime=0}) = 508452286 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=0, tv_usec=0}}, NULL) = 0 write(3, "\1\7\0\1\0\236\2\0PHP message: PHP Warning: Unknown: failed to open stream: Success in Unknown on line 0\nUnable to open primary script: /www/aa.xxx.cn/public (Success)\n\0\0\1\6\0\1\0Z\6\0Status: 404 Not Found\r\nContent-type: text/html; charset=UTF-8\r\n\r\nNo input file specified.\n\0\0\0\0\0\0\1\3\0\1\0\10\0\0\0\0\0\0\0\0\0\0", 288) = 288 shutdown(3, SHUT_WR) = 0 recvfrom(3, "\1\5\0\1\0\0\0\0", 8, 0, NULL, NULL) = 8 recvfrom(3, "", 8, 0, NULL, NULL) = 0 close(3) = 0 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, it_value={tv_sec=0, tv_usec=0}}, NULL) = 0 accept(0,
6.访问html文件正常php文件报错已经确定了是php这边的问题,但是具体原因无法定位,这个报错信息和网上所有的案例都不通过 7.从网上从新下载php7.4然后编译安装,监听端口9004,修改nginx里面fpm的监听端口,然后重启nginx,再次访问同样地址,就正常了