• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Can't Edit Files with Plesk File Manager

LordLiverpool

Basic Pleskian
Hello Plesk

Following on from my last post http://forum.parallels.com/showthread.php?290144-Unable-to-Upload-to-Server

I decided to cut Filezilla out of the picture.

1. So I logged onto my VPS
2. Picked a subscription
3. opened in control panel
4. picked websites & domains tab
5. clicked File Manager
6. drilled down to the file i wanted

File Manager.JPG

7. clicked on the pencil
8. made my changes
9. clicked Save

File I want to Edit.JPG

My changes are not saved.

Please screen shots.

Can anyone please help???
 
Thanks for adding the screen shots.

From the looks of things, all the files are owned by apache. Maybe you used the Plesk Application Catalogue to install something? File manager can only handle files owned by (the ftp username), hence the problem.

As to what to do about it...I'll get back to you on that. I just want to update my post about your FTP problem first.
 
OK, look -- this is complicated. I don't know what to suggest here without risking damage to your website and even your VPS.

When run as mod_php, any files that php created are owned by apache and NOT the ftp username for this Subscription. Using FTP or the Plesk File Manager, you then can't edit/delete/overwrite any of the files.

To rectify this, I'd change the PHP mode to php_fgci, then chown -R all the website files and directories in httpdocs to your-ftp-username.psacln. This will make everything owned by the ftp username, allowing you to use FTP and also the file manager to edit/delete them, and all will be well under most circumstances. And any new files created by php will be owned by the FTP username and not Apache due to the use of php_fcgi mode.

But although the words are simple and the commands to achieve them are easy enough, to blindly do so would be potentially inviting trouble. You could really screw things up with a single mistyped letter (not really - I'm exaggerating - but I suppose anything is possible). Also possible is that the application you have installed could stop working.

I'm therefore reluctant to go into any detail here. I don't want to be even indirectly responsible problems you might encounter.

Tell you what -- if there's a particular file you really want to edit, and editing or overwriting the file isn't possible within the application (e.g Wordpress or whatever it might be) itself (which will have permission to edit files owned by apache if in mod_php mode), then you could chown that individual file to your ftpusername. You would then be able to edit it using File Manager of FTP. And by doing just that individual file, if it doesn't work or stops your application from working, you could always chown it back to apache.apache.

But everything is at your own risk. Don't blame me if it all goes horribly wrong, OK? I'm not always right. I make mistakes. I mistype stuff. You have been warned.
 
Hi Faris
What you are suggesting sounds good to me.
I don't know how to change the PHP mode to php_fgci ??? (sorry)

My understanding of what you are suggesting I do is:

1. chown the file I wish to download
2. download it
3. make my edit php/html/css edits
4. upload it (should work now)
5. chown the file back

I have a spare domain that I can practice upon.
I assume that if I perform a recursive change of ownership from apache to ftp then my other "live" domains will be unaffected??? The command only works from the folder (and its subordinate folders) the command was issued from?

Hey don't worry if anything goes wrong because as it currently stands I am stuck.
I am unable to make progress and the customer’s website isn't taking shape.
Therefore I am prepared to take the risk and I certainly wouldn’t blame you.

If modifying a single file works then I will progress to modifying all the files under http: for the test domain
If the test domain still works then I will modify all the files under http for the customer's domain.

Just to confirm. I am including this screen shot to show you how I install an instance of WordPress via Plesk

how i install applications.jpg

I wanted you to be able to confirm/deny if installing WordPress this way is the cause of all the files being owned by Apache rather than FTP.

This is probably a stupid question, but why if I installed WordPress via the Plesk Interface did the people in charge of Plesk decide it was a good idea to give ownership of all the files to apache thereby preventing me from editing the files? Surely they should have realised that WordPress installations would need modifying at some point? Unless they assume changing ownership of files is as easy for a competent Linux administrator.

I will look up the chown command
I will look up how to access the command line interface

The gui equivalent of chmod doesn't work, is this because I don't own the files?

Would you say my summary of what you said is correct?

Thanks very much
 
Ok so I realised I needed to access the command line to issue a unix command to change ownership.

I wasn't sure where to find the command line interface, so I thought I can't be the first person to have ever encountered this issue.
So I did a google search which found this article on the Parallels forum

http://forum.parallels.com/showthread.php?103833-Where-is-the-command-line-interface-Please-help

Within that thread was the following post:

to locate the Command line interface in PLESK do the following.

1. goto you plesk panel and login using your login and password
2. click on domains on the left hand panel
3. click on your domain
4. under "files" locate ssh panel

5. if it is not there do the following

6. click on "domain administrator access"
7. slide down to "Management of access to server over SSH"
8. choose "Domain administrator can allow access to any type of shell"
9. save your work
10. repeat steps 3 and 4

So I followed those instructions but this is what I was greeted with:

command line.JPG

So my questions are:

1.) Am I in the right place?
2.) What does that error message mean?
3.) What do I do next?
4.) If I am logged on as administrator why is there an authorization problem (unless being admin makes no difference)

Does anyone know what I should do next??

Thanks in advance
 
Hi Faris

Sorry to be a pain. I was wondering if the last screen shot I sent you was connected in any way to my original point?

I posted a question over on the Filezilla forum: https://forum.filezilla-project.org/viewtopic.php?f=2&t=30691
and they said roughly the same as you, that the issue is with the server, not the way I configured the Filezilla client.
So that backs up what you said

They also said that chown is not supported over FTP or SFTP and that I need to use WinSCP.

I logged onto the server using the original credentials given to me by my VPS provider. i.e root and an auto generated password. But it made no difference. I was still unable to access the CLI.

I thought maybe I was doing something wrong. So I tried to acccess the CLI by following the instructions I found here:
http://forum.parallels.com/showthread.php?103833-Where-is-the-command-line-interface-Please-help
But I ended up in the same place and when I was in the File Manager I tried to view files and I got the same error message in the screenshot in my previous post.
So I think I am unable to access my CLI. Strange no?

I have put a support ticket in with my VPS provider but they are closed until Tuesday, as its a bank holiday here in the UK tomorrow.

If you can offer any advice or if anyone else can, please reply.

Thank you
 
Ok I worked it out

1.) changed my FileZilla profile from the FTP user to root.

2.) downloaded, edited and uploaded an image to one of my domains.

3.) I logged into my CLI via Putty as root

4.) navigated to the the websites are hung off i.e. /var/www

5.) changed ownership of the file from root to apache e.g. chown apache:apache filename.ext

6.) refreshed the website

7.) BINGO!!!

Thanks to Faris for your help!!
 
Last edited:
OK, I'm finally caught up with things.

So, basically you've got it all sorted, which is great.

But ideally you want to be in a position where you don't need to worry about permissions etc, and this is where changing the site to run as php_fastcgi comes into the equations.


To go back to what I said a few posts back, there are two main ways to run php on a website in Plesk.
1) The traditional way is using mod_php. This is the fastest and simplest method, and was the only option up until Plesk 8.6.
This is the mode you currently have your website set to. The drawback is that in this mode, php scripts run as "apache" and so when they create files, they are owned by apache. This prevents you modifying such files using FTP or the File Manager, because they run as the FTP username and not apache. Worse still, this mode usually requires certain directories and some files to be chmoded 777 for certain types of scripts that need to write files. This, and various other things, makes this mode "insecure" and it is no longer recommended.

2) The "new" way is to run PHP in FastCGI mode. This uses more resources (memory, some CPU) than mod_php mode, but brings with it all sorts of advantages. Greatly increased security is one, part of which is down to the fact that php scripts now run as the FTP user for the site. Files created by scripts are now owned by ftpusername and so File Manager and FTP clients can edit and delete them just fine. Oh, AND on top of everything else, sites running php in this mode can have their own custom php settings, which can be very, very useful and can again increase security.


To change the mode for an individual site, in the control panel for the site, click on the "Websites & Domains" tab, then on "Show Advanced Options", then select "Website Scripting and Security".

Scroll down a bit and you'll see some options under "Web Scripting and Statistics", one of which is a tick box for "PHP support" with a drop-down next to it which is where you can change the way php runs.

In Plesk 10.4.4, the options are:
Apache Module (which is option 1 above. Apache module = mod_php)
FastCGI Applications (php_fastcgi option 2 above)
CGI Application (which I've not mentioned at all until now as it is a half-way-house thing nobody uses except maybe for backward compatibility)

So, to change the mode, select the one you want then click on OK at the bottom.

If you decide to change to FastCGI, you'll need to chown ALL the files and directories in your site from apache to match the ftp username.

# cd /var/www/vhosts/your-domain.tld/httpdocs
# chown -R your-ftp-username.psacln *

The above will NOT chown any files starting with a dot (e.g. .htaccess) which you might have, for which you might need to do
# chown -R your-ftp-username.psacln .[^.]* (at least I think that will work...ummm...experiment on a test directory first just in case, OK?)


See http://serverfault.com/questions/15...rsively-including-hidden-files-or-directories for a confusing discussion on this.

Do not be tempted to use " chown -R your-ftp-username.psacln . " (i.e. a dot at the end instead of a *) because that will change the current directory (httpdocs) as well as all files and directories and hidden (dot) files, which you don't want to do as it will stop your site working. This is one of those "one letter out and you're screwed" things.

Also be very careful about "chown -R" in general, because if you do it in the wrong place accidentally, you are screwed. There's no "undo" in Linux (in this context).

Going back to PHP in FastCGI mode, I recommend that you configure your Service Plans to use this mode by default so that any new sites you create will use it as standard.

Be aware that some people would disagree with me on this, because this mode does use more resources than mod_php mode. Basically it is something to consider carefully. If you only run one site, or a couple of sites, I don't think it will make a difference.

Finally: If it ain't broke, don't fix it. What I'm outlining here involves a lot of changes. Your site could break. There could be some reason why you need to use apache.apache on that site. It might not like you fiddling about with it. So unless you really want to experiment, my recommendation is "don't touch" and continue doing things in the way you are doing them.

NOTE: I could have made an error in my outline above, so follow any advice I give at your own risk. Like I said before, I don't want to be accidentally responsible for something horrible happening to your site or your VPS :-(
 
Back
Top