Search code examples
phpubuntueclipse-lunalinux-minteclipse-mars

Unable to save php files in eclipse Luna and Mars, Linux Mint 17.3


I am a novice in using eclipse in Linux environment. Recently, I have installed Eclipse Luna (for PHP) as a PHP editor. I did not have any problem with it for couple of days, but from yesterday every time I try to save changes to php files in my project with eclipse (Luna) I receive this error: Save could not be completed. Try File> Save as if the problem persists. Reason: Could not write file: /var/www/html/myPHPProject/pathToFile.php Details:/var/www/html/myPHPProject/pathToFile.php(Permission denied)

Even when I try save-as, the same thing happens. Nevertheless,I am able to edit through 'sudo gedit' command. But it is not practical to open a file with 'sudo gedit' every time I want to make changes to a specific PHP file.

I have searched all over the net to find the solution, however it seems not many people have faced the same problem. So I could not find any helpful solution.

The unsuccessful steps I took to resolve the problem: - Changed workspace from /home/user/workspace to root/workspace - Moved eclipse folder from Home to opt in filesystem - Installed eclipse Mars(for PHP):The same happened

I also tried to open eclipse by 'sudo eclipse' command and it did not open. So based on some suggestions I did this 'sudo apt-get install eclipse' (I know: it was a stupid call). After that by 'sudo eclipse' I had a new eclipse version for java open (which I didn't want). I also tried 'cd' to the eclipse luna folder in opt and do 'gksudo eclipse' and it didn't work either.

Any ideas what can I do about this problem? (I have tried to provide detailed information about this question. If I have missed any thing please let me know.)

Thanks In advance.

Edit: I've checked the actual project folder and it seems I have the small lock icon on very few php files that I've generated with artisan commands of Laravel framework in PHP. But if I create a PHP file in eclipse I don't have any problem saving it.

The problem about saving these few php file is still there and I want to be able to change the permission. But I don't know what would work.


Solution

  • For anyone who faces the same problem:

    After some hints from @durbnpoish about 'chmod' I have tried to change the 'chmod' permission in my project folder. After doing some research I found this post : How do I set chmod for a folder and all of its subfolders and files in Linux Ubuntu Terminal? and applied these commands :

    'find /var/www/html -type d -exec chmod 755 {} \;'

    'find /opt/lampp/htdocs -type f -exec chmod 644 {} \;'

    But none of them worked. So I had to find out about real meanings of the three numbers in 'chmod'. After reading this post:

    https://askubuntu.com/questions/263450/folders-showing-lock-icon

    Then I've tried this command:

    find /var/www/html/myProject -type f -exec chmod 777 {} \;

    And my problem was solved.