• Resolved Iuri Oliveira

    (@iuri-oliveira)


    Good morning everyone,

    I am performing the installation of a WordPress website and the ISP I use, accepts only update via FTP.

    However I can not perform the update. I will explain the scenario, all steps completed, what has changed and what my analysis.

    1 Scenario
    * I use version 4 of WordPress and need to perform the installation of plugins via FTP (any plugin).
    * I have access to the FTP server that has 775 permissions for directories and 664 for files

    2 Testing conducted
    * In the first attempt to update with the default WordPress configuration the following message appears:

    Unable to locate WordPress Content directory (wp-content).

    * So, I performed the modification to manually set the directory: wp-content in the file: wp-config.php
    define(‘FS_METHOD’,’ftpext’);
    define( ‘FTP_BASE’, ‘/acta/’ );
    define( ‘FTP_CONTENT_DIR’, ‘/acta/wp-content/’ );
    define( ‘FTP_PLUGIN_DIR ‘, ‘/acta/wp-content/plugins/’ );

    * After trying to update the plugin again the following message was displayed;
    Could not copy file. jetpack/functions.opengraph.php

    * I tried to find what the directory path he was trying to copy, so I changed the contents of the file: wp-admin / includes / file.php

    1 if ( ! $wp_filesystem->put_contents( $to . $info[‘name’], $contents, FS_CHMOD_FILE) )
    2 return new WP_Error( ‘copy_failed_ziparchive’, __( ‘Could not copy file.’ ), $info[‘name’] );
    3 }

    I changed line 3 to display the variable $ to
    2 return new WP_Error( ‘copy_failed_ziparchive’, __( ‘Could not copy file.’ ), $to );

    * After another attempt to update the following error was displayed:
    Unable to copy the file. /acta/wp-content/upgrade/jetpack.tmp/

    3 Analysis
    * I have no deep knowledge of PHP or WordPress, but I imagine that I have to define 2 differents paths, one to file copy and another to FTP. I also tried to set the absolute path for copying, but still the same message appears:

    define (‘WP_CONTENT_DIR’, ‘/www/teste.com.br/htdocs/acta/wp-content’);

    As quoted, it is just a suspect.

    I thank your attention to this case.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Unless I’m mistaken, if your WP_CONTENT_DIR is /www and you’re trying to set the FTP_BASE to /acta/ I’m gonna bet that /acta doesn’t exit. In a unix environment adding a slash at the beginning represents an absolute path, so /www/teste.com.br/htdocs/acta isn’t the same as /acta/.

    Try changing your FTP paths to /www/teste.com.br/htdocs/acta/ and so on.

    A quick rundown of relative vs absolute paths in unix/linux: http://www.linuxnix.com/2012/07/abslute-path-vs-relative-path-in-linuxunix.html

    Thread Starter Iuri Oliveira

    (@iuri-oliveira)

    Thanks for the answer Jerry.

    When I change the FTP path to /www/teste.com.br/htdocs/acta I got the massage:
    “Unable to locate WordPress Plugin directory.”

    There is a bind to FTP user access the server. When I change this value, the wordpress is trying to access the directory: /www/teste.com.br/htdocs/acta/www/teste.com.br/htdocs/acta. The path to this user, during the FTP access is the directory after; /www/teste.com.br/htdocs/

    The FTP user has /www/teste.com.br/htdocs as his home directory.

    Ahh ok, then instead of using /acta/ as the directory, try using just acta/ without the leading slash.

    It’s been so long since I’ve had to do this, I’m abit rusty.

    Thread Starter Iuri Oliveira

    (@iuri-oliveira)

    I’ve tried using this way, but the message was the same without the slash:

    “Could not copy file… iuri/wp-content/upgrade/jetpack.tmp/”

    Thread Starter Iuri Oliveira

    (@iuri-oliveira)

    Jerry, I also tried changing FS_METHOD to direct, but only works if I ask to change the owner of the WordPress directory to the user who starts Apache (www-data), but if I do this, I can not make any modification using FTP, because the owner of the directory is now different and the permission is 775. Is it possible to inform to WordPress the user of the FTP in the FS_METHOD “direct”?

    Again appreciate the attention.

    Thread Starter Iuri Oliveira

    (@iuri-oliveira)

    Jerry, thanks again. I solved the problem doing these steps:

    – I changed the FS_METHOS to direct
    – My provider included www-data user in the same FTP user group. This way, with 775 permission I can install and update WordPress
    – I still can’t upload using FTP method, but I don’t need to make any manual process anymore

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Error installing Plugins/Themes – Could not copy file’ is closed to new replies.