0

I have installed WordPress 3.6.1 on Debian 6.0.8 (alongside with other websites) by following this tutorial https://wiki.debian.org/WordPress.

I keep strugling with wordpress asking for ftp Connection Information for theme or plugin updates.

Could you please help me setting the rights correctly ?

Looking forward to read from you

What I can to do

  • install/delete plugin
  • install/delete themes

What I can't do

  • display theme nicely unless I manually create the symbolic link to the files.

Posts I have read :

What I have tried

Set FS_METHOD to direct in /etc/wordpress/config-mydomain.fr.php

define('FS_METHOD', 'direct');

Re assigh permissions :

admin@server01:/usr/share/wordpress$ find -type d -exec sudo chmod 755 {} \;
admin@server01:/usr/share/wordpress$ find -type f -exec sudo chmod 644 {} \;
admin@server01:/usr/share/wordpress$ ls -l
total 144
-rw-r--r--  1 root root       395  8 janv.  2012 index.php
-rw-r--r--  1 root root      7155 14 sept.  2013 readme.html
-rw-r--r--  1 root root      4616 21 janv.  2013 wp-activate.php
drwxr-xr-x  9 root root      4096 19 mars  13:00 wp-admin
-rw-r--r--  1 root root       271  8 janv.  2012 wp-blog-header.php
-rw-r--r--  1 root root      3513 16 juil.  2013 wp-comments-post.php
-rw-r--r--  1 root root      2381 13 sept.  2013 wp-config.php
-rw-r--r--  1 root root      3177  1 nov.   2010 wp-config-sample.php
drwxr-xr-x  5 root www-data  4096 19 mars  13:00 wp-content
-rw-r--r--  1 root root      2718 23 sept.  2012 wp-cron.php
drwxr-xr-x 10 root root      4096 19 mars  13:00 wp-includes
-rw-r--r--  1 root root      1997 23 oct.   2010 wp-links-opml.php
-rw-r--r--  1 root root      2408 26 oct.   2012 wp-load.php
-rw-r--r--  1 root root     29751 23 juil.  2013 wp-login.php
-rw-r--r--  1 root root      7715  3 mars   2013 wp-mail.php
-rw-r--r--  1 root root      9990 21 févr.  2013 wp-settings.php
-rw-r--r--  1 root root     22135 15 mai    2013 wp-signup.php
-rw-r--r--  1 root root      3692  9 mai    2013 wp-trackback.php
-rw-r--r--  1 root root      2722  4 mars   2013 xmlrpc.php

&

admin@server01:/var/lib/wordpress$ find -type d -exec sudo chmod 755 {} \;
admin@server01:/var/lib/wordpress$ find -type f -exec sudo chmod 644 {} \;
admin@server01:/var/lib/wordpress$ ls -l
total 4
drwxr-xr-x 8 www-data www-data 4096 20 mars  15:04 wp-content

Manually remove broken plugin

admin@server01:/var/lib/wordpress/wp-content/plugins$ sudo rm akismet
admin@server01:/usr/share/wordpress/wp-content/plugins$ sudo rmdir akismet/

Manually remove broken themes

admin@server01:/usr/share/wordpress/wp-content/themes$ sudo rmdir twentythirteen/
admin@server01:/usr/share/wordpress/wp-content/themes$ sudo rmdir twentytwelve/

&

admin@server01:/var/lib/wordpress/wp-content/themes/clear$ sudo rm *
admin@server01:/var/lib/wordpress/wp-content/themes$ sudo rmdir clear/

Manually define themes symbolic links that dont want to appear automatically

admin@server01:/usr/share/wordpress/wp-content/themes$ sudo ln -s '/var/lib/wordpress/wp-content/themes/clear' 'clear'

Restart ssh :

admin@server01:~$ sudo /etc/init.d/ssh restart
Restarting OpenBSD Secure Shell server: sshd.

Restart apache :

admin@server01:~$ sudo service apache2 reload
Reloading web server config: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 92.243.##.### for ServerName

/etc/apache2/sites-available/fr.mydomain.www

   <VirtualHost *:80>
        ServerName mydomain.fr
        ServerAlias www.mydomain.fr

        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^mydomain\.fr
        RewriteRule $(.*)$ http://www.mydomain.fr$1 [R=permanent,L]

        DocumentRoot /usr/share/wordpress/

        DirectoryIndex index.php index.html

        ErrorLog /var/log/apache2/wp-error.log
        TransferLog /var/log/apache2/wp-access.log

        <Directory /usr/share/wordpress>
            Options -Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>

        ScriptAlias /wp/wp-content /var/lib/wordpress/wp-content/
        ScriptAlias /wp /usr/share/wordpress/

        <Directory "/var/lib/wordpress/wp-content">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
        </Directory>

   </VirtualHost>

/etc/wordpress/config-mydomain.fr.php

<?php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'myPassword');
define('DB_HOST', 'localhost');
define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');
define('FS_METHOD', 'direct');
?>

Apache seems to run as root

ps aux | grep apache

root     11565  0.0  0.7 227076 15040 ?        Ss   Mar19   0:03 /usr/sbin/apache2 -k start
root     23668  0.0  0.3 227212  7500 ?        S    10:07   0:00 /usr/sbin/apache2 -k start
...
root     26875  0.0  0.3 227212  7500 ?        S    12:50   0:00 /usr/sbin/apache2 -k start
admin    27111  0.0  0.0   9620   916 pts/1    S+   13:18   0:00 grep apache

777* I have tried to change /usr/share/wordpress/wp-content and /var/lib/wordpress/wp-content to 777 without success...and I know that is very very bad.

Community
  • 1
  • 1
JBo
  • 43
  • 1
  • 6
  • You don't seem to have tried to [define the `FTP_*` constants](http://stackoverflow.com/a/17135586/1287812). – brasofilo Mar 20 '14 at 14:19

1 Answers1

0

Maybe this is because of some weird behaviour of Wordpress: The check whether WP has write permissions creates a temporary file and compares the owner of that file (which will be the Apache process, www-data) to the result of getmyuid(). However, getmyuid() returns the owner of the running php file (wp-admin/update.php in this case) which is 0 (root) in the default install. Try to change the owner of this file to www-data, which made it work for me:

chown www-data:www-data /usr/share/wordpress/wp-admin/update.php
FranzB
  • 21
  • 3