Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making executable all PHP files (recursively)

Tags:

bash

php

chmod

I just downloaded MediaWiki software on my server for installation. After decompressing it, I noticed that PHP files were not executable.

I ran chmod +x *.php* (there are also .php5 files) but it didn't work in subdirectories.

How can I add the executable flag to all PHP scripts inside the MediaWiki folder recursively scanning the subfolders?

Thank you in advance.

like image 549
usr-local-ΕΨΗΕΛΩΝ Avatar asked Dec 27 '10 14:12

usr-local-ΕΨΗΕΛΩΝ


2 Answers

Use bash in the MediaWiki directory

find . -iname "*.php" | xargs chmod +x
like image 79
shfx Avatar answered Nov 08 '22 14:11

shfx


It does not work in subdirectories, because *.php* does not match any directories and hence does not include it.

Therefore you should use something like find ./ -iname "*.php*" -exec chmod 755 {} \; with the respective bits to set.

like image 2
philonous Avatar answered Nov 08 '22 15:11

philonous