php7.2.10+mysql+Ptcms源码调试

这篇博客详细记录了在Fedora系统中安装PHP7.2.10、MySQL并调试Ptcms源码的过程,包括文件权限设置、VMware Tools安装、虚拟目录配置、PHP文件不识别问题、Selinux影响及解决方案、报错排查、数据库配置等,最后遇到了PHP扩展mysql.so加载失败的问题,尝试了多种解决办法。
摘要由CSDN通过智能技术生成

1更改权限
Fedora的文件夹权限更改

su root
ls -l
groups //查看当前登录用户的组内成员
groups gumu wheel  //查看gliethttp用户所在的组,以及组内成员
whoami //查看当前登录用户名

useradd fuyun
passwd fuyun

vim /etc/sudoers

修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉

## Allows people in group wheel to run all commands
%wheel    ALL=(ALL)    ALL
#然后修改用户,使其属于root组(wheel),命令如下:
#usermod -g root fuyun
#修改完毕,现在可以用fuyun帐号登录,然后用命令 su - ,即可获得root权限进行操作。
fuyun   ALL=(ALL)     ALL

2VM共享文件夹
安装VMware tools
在虚拟机菜单中选择虚拟机——安装VMware Tools
然后打开文件管理器,会发现多了个VMware Tools,打开
解压VMware Tools.tar.gz,随便解压到一个地方,然后用在终端切换到解压后的目录,然后输入./vmware-install.pl即可

mkdir /mnt/cdrom
cd  /mnt/cdrom
cp VMwareTools-10.2.5-8068393.tar.gz /usr/
cd /usr/
tar xvfz VMwareTools-10.2.5-8068393.tar.gz
vmware-tools-distrib/vmware-install.pl

vmware-hgfsclient //列出共享文件夹
vmhgfs-fuse /mnt/cdrom/   //即可将共享文件夹挂载到/mnt/cdrom下面
cp -r /mnt/cdrom/soft/php/ /usr/share/   //把共享文件夹拷入目标文件夹

3 设置虚拟目录

vim  /etc/nginx/nginx.conf


location /www {
         alias /usr/share/php/wwwphp/;       #后面的"/"符号一定要带上
        }
systemctl restart nginx.service

sudo -s mv /usr/share/php/wwwphp/ usr/share/

:w !sudo tee % //vim 强制保存退出

chmod 777 ptcms

4 不认PHP文件

dnf install php-fpm
service php-fpm start #启动php-fpm
vim  /etc/nginx/nginx.conf

include /etc/nginx/default.d/*.conf;  #如果上面包含这个文件则打开这个文件

vim  /etc/nginx/default.d/php.conf
# pass the PHP scripts to FastCGI server
#
# See conf.d/php-fpm.conf for socket configuration
#
index index.php index.html index.htm;

location ~ \.(php|phar)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;

    fastcgi_intercept_errors on;
    fastcgi_index  index.php;
    include        fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  PATH_INFO $fastcgi_path_info;
    fastcgi_pass   php-fpm;
}

改为

vim  /etc/nginx/default.d/w.conf


# wwwphp

location /w {
         alias /usr/share/wwwphp/ptcms/;      
        }

location /ptcms/ {
     root /usr/share/wwwphp;
     index index.php index.html;

     location ~ ^/ptcms/(.+\.php)$
     {
         try_files $uri =404;
         fastcgi_intercept_errors on;
         include        fastcgi_params;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         fastcgi_pass   php-fpm;
     }
}



# ptcms 

location /ptcms {
         alias /usr/share/wwwphp/ptcms/;
        }

location /ptcms/ {
     root /usr/share/wwwphp;
     index index.php index.html;

     location ~ ^/ptcms/(.+\.php)$
     {
         try_files $uri =404;
         fastcgi_intercept_errors on;
         include        fastcgi_params;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
         fastcgi_pass   php-fpm;
     }
}

Nginx配置中指令root和alias的区别浅析
重启

service nginx restart

service php-fpm restart

报错

See "systemctl status nginx.service" and "journalctl -xe" for details

//按照提示,执行此命令,查看错误原因
 systemctl status nginx.service

nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor prese>
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           └─php-fpm.conf
   Active: failed (Result: exit-code) since Fri 2018-09-21 21:07:09 CST; 1min 5>
  Process: 891 ExecStart=/usr/sbin/nginx (code=exited, status=
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值