简体   繁体   English

使所有PHP文件可执行(递归)

[英]Making executable all PHP files (recursively)

I just downloaded MediaWiki software on my server for installation. 我刚刚在我的服务器上下载了MediaWiki软件进行安装。 After decompressing it, I noticed that PHP files were not executable. 解压缩后,我注意到PHP文件不可执行。

I ran chmod +x *.php* (there are also .php5 files) but it didn't work in subdirectories. 我运行chmod +x *.php* (也有.php5文件),但它在子目录中不起作用。

How can I add the executable flag to all PHP scripts inside the MediaWiki folder recursively scanning the subfolders? 如何将可执行标志添加到MediaWiki文件夹内的所有PHP脚本中,以递归方式扫描子文件夹?

Thank you in advance. 先感谢您。

在MediaWiki目录中使用bash

find . -iname "*.php" | xargs chmod +x

It does not work in subdirectories, because *.php* does not match any directories and hence does not include it. 它在子目录中不起作用,因为*.php*与任何目录都不匹配,因此不包含它。

Therefore you should use something like find ./ -iname "*.php*" -exec chmod 755 {} \\; 因此你应该使用像find ./ -iname "*.php*" -exec chmod 755 {} \\; with the respective bits to set. 用各个位来设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM