WordPress.org

Ready to get started?Download WordPress

Forums

Why does WordPress need FTP credentials to install a plugin? (4 posts)

  1. davehprohoods
    Member
    Posted 6 months ago #

    PHP can install code from the web using curl; I don't understand why WordPress needs to give it FTP credentials which just go to the same server it's on.

  2. catacaustic
    Member
    Posted 6 months ago #

    You are mostly right. PHP can use CURL to download and install, but onyl if the web user (on the server, not in WordPress) has the required permissions to do so. On a lot of servers the web user doesn't have the required permissions to download/update files, so WordPress uses FTP as a fallback when it can't do it the "easy" way.

  3. davehprohoods
    Member
    Posted 6 months ago #

    I see. So since the web user (apache) has full r/w permissions (and I know how to fix it anyways if it doesn't), is there not a switch I can flip so it falls back on the "easy" cURL way? How is it determining that it can't do it that way?

  4. catacaustic
    Member
    Posted 6 months ago #

    Not that I know of. You can heck the soruce code to see how it does it's checks, but from what I'd guess it would use one of the more generic PHP functions (like is_writable() or touch()) to determine if the system will allow it to write to the file system. It may be worth adding in a test page to check, something like...

    <?php
    if (touch ('test.tmp')) {
        echo "Writable!";
    }
    else {
        echo "Not writable.";
    }

    That will tell you if the system has the write permisions, and if it doesn't you can fix that.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.