Linux Lite Forums

Software - Support => Other => Topic started by: bahmanjalal on November 07, 2019, 05:26:59 AM

Title: How to remove Execute option from right click for php files
Post by: bahmanjalal on November 07, 2019, 05:26:59 AM
Hello.
I hope you be fine.
I have a problem for PHP files.
I set Atom editor for PHP files but when i put enter on PHP files, they didn't open because they can open just with execute option.
See on bellow pic :
(https://www.uplooder.net/img/image/87/06618ca431575dbcb9149960dd519d7e/Screenshot-2019-11-07-13-33-55.png)
Atom editor didn't set to default. All time i must use of "open with" on right click action.
Thanks :)
Title: Re: How to remove Execute option from right click for php files
Post by: trinidad on November 07, 2019, 09:34:17 AM
Not sure what you are attempting to do here, and your image does not display enough info,  but you wouldn't want atom to be the default application for opening php files from Thunar. You don't need Thunar to look for your files as atom finds it's own files with >File >Open from the menu bar, however it won't find a file that is not in a folder, which means you shouldn't save your files to your home directory, i/e create a folder in your home directory named ~/atomproject1 or something like that and save your project files there. Then you will be able to open them directly from atom.
TC
Title: Re: How to remove Execute option from right click for php files
Post by: Jerry on November 07, 2019, 09:52:33 AM
Change the permissions to non-executable.

Sent from my Mobile phone using Tapatalk

Title: Re: How to remove Execute option from right click for php files
Post by: bahmanjalal on November 07, 2019, 01:41:15 PM
Hello again.
Thanks a lot for your help.
I do these :
sudo chown future:future test.php
sudo chmod a-x test.php
sudo chmod 777 test.php
But this php file is executable yet !
I do wrong ?
Thanks a lot.
Title: Re: How to remove Execute option from right click for php files
Post by: Jerry on November 07, 2019, 02:38:11 PM
chmod -x filename.php or chmod -x *.php for all php files in that directory.
Title: Re: How to remove Execute option from right click for php files
Post by: bahmanjalal on November 08, 2019, 01:07:22 PM
Hello again.
Thanks a lot for your help.
I checked and in Home directory no problem for PHP files.
I use of NTFS partition on my HDD and I changed NTFS partition with " gksudo ntfs-config "  command that you can see below :
(https://www.uplooder.net/img/image/30/f8bee83d1e4e01fa79c2f913c9c5e674/gksudo.png)
On those partitions, I can't disable execute permission. When I do these commend :
Code: [Select]
sudo chmod -x /media/ -Rall files and folder will be hidden and I must change permission to 755 for media folder for unhidden all things.
Just I have problem for disabling execute on my NTFS partitions.
Thanks a lot for your guide.
Title: Re: How to remove Execute option from right click for php files
Post by: Jerry on November 08, 2019, 02:50:35 PM
You need to be owner of ntfs partitions to change perms.

Code: [Select]
sudo chown -R future:future /media/future/files/
Code: [Select]
sudo chown -R future:future /media/future/film/
then you can:

Code: [Select]
chmod -x /path/to/phpfiles/*.php
Title: Re: How to remove Execute option from right click for php files
Post by: bahmanjalal on November 13, 2019, 05:04:04 PM
Hello and thanks a lot for your guide .
I did it and i get error "Read-only file system" for all files. For example :
chown: changing ownership of '/media/future/files/VProRecovery/VProRecoveryStorage.ini': Read-only file system.
I think an action is active and don't allow me to change permission and user group.
Thanks again.
Title: Re: How to remove Execute option from right click for php files
Post by: Jerry on November 13, 2019, 06:22:21 PM
I don't think you should be trying to change perms on a Recovery partition, they need to stay as they are. Be selective about what you change perms on, eg. nothing related to Windows. Not saying it can't be done, just best practice not to.
Title: Re: How to remove Execute option from right click for php files
Post by: jerryc on November 13, 2019, 11:49:19 PM
I've had similar problems with using .php files.

First of all, I agree with the real Jerry -- don't work with the recovery disk. Copy the PHP files you want to work with to someplace else.

Then, when you need to use them, here's a hack that worked for me:

Bulk rename to all those archived *.php files to *.php.txt (for example, or some other hack that works for you). A .txt file normally won't be executable, no matter what's in it. If they still keep their executable permissions, you can navigate to the directory and run:

Code: [Select]
chmod 664 ./*.php.txt
... or whatever permissions you want to set.

If you need code highlighting in your text editor, edit your editor's view preferences so such files display just like .php files.

Then, when you actually need to use the files, rename them back to .php. Alternatively, if you're including them into other .php files with an include or require call, you may be able to just include them as named. I've included many files without .php suffixes into .php files, and had all the included text executed as PHP code. YMMV.