0
votes

I encountered this problem when I am trying to upload image files to my wordpress. I am using XAMPP on a Mac OSX Mavericks. I also upgraded to the latest wordpress version (3.8.1). I already tried the ff methods to solve this:

  • Method 1: I added the ff codes to the wp-config.php

    define('UPLOADS', '/migsmarbella.com/wp-content/uploads'); define('WP_CONTENT_URL', 'http://migsmarbella.com/wp-content');

"migsmarbella.com" is the name of my wordpress folder.

  • Method 2: CHMOD the particular folder "migsmarbella.com" using Terminal Utility

    sudo chown -R nobody:staff /applications/xampp/xamppfiles/htdocs/migsmarbella.com

  • Method 3: I also checked the "migsmarbella.com/wp-content" folder's permission settings (Right Click then "Get Info") which stated that "user" can read and write files, while "staff" and "everyone" can only read files.

  • Method 4: I unchecked the "Organize my uploads into month- and year-based folders" checkbox, then saved the setting changes inside Settings > Media.

Are there any better methods out there? Please help. Thanks.

P.S. Method 2 didn't work especially since it restricted my permission settings I have to undo the command I did by changing "nobody" into my mac's username.

Additional: It seems this whole changing permission settings is getting more and more confusing. Can you guys give me the first step, the exact way to change permission settings of a folder in MAC? I tried to use Filezilla but I cannot find the command to chmod folders, at least in the Mac version.

5

5 Answers

1
votes

First I'm using XAMPP for OS X 1.8.2-5 running the apache, mysql and ftp services, also the new wordpress 4.0, so I added this to my wp-config.php:

define('FTP_HOST', 'localhost');
define('FTP_USER', 'daemon'); /* check the user at XAMPP_dir/xamppfiles/etc/proftpd.conf */
define('FTP_PASS', 'xampp'); /* also the password is at XAMPP_dir/xamppfiles/etc/proftpd.conf */
define('FS_METHOD', 'ftpsockets');
define('FTP_BASE', '/XAMPP_dir/xamppfiles/htdocs/wordpress'); /* check/mod your path */

Also the ownership, hope this helps

1
votes

After trying everything, I fount out this way to solve it which consisted in getting the actual username of the server. I wrote a small php script for this:

<?php
echo '<pre>';

$user = system('whoami', $retval);

echo '
</pre>
<hr />Ultima linea de la salida: ' . $user . '
<hr />Valor de retorno: ' . $retval;
?>

I ran it at http://localhost/wordpress/test.php and got the username daemon. I then changed the permissions to this user sudo chwon daemon -R wordpress and solved!

0
votes

From your code you no need to define the path of your website as like migsmarbella.com Not sure why you targetting the path as with your site url? It take automatically of your corresponding site path you don't even put a path including your site url. Your code of defining the path is not the correct way

define('UPLOADS', '/migsmarbella.com/wp-content/uploads'); 
define('WP_CONTENT_URL', 'http://migsmarbella.com/wp-content');

Correct way is as below.

Open up your wp-config.php file, located at the root of your WordPress installation, and add the following code

define('UPLOADS', 'wp-content/yourfoldername');

The codex specifies that it should be added before the line that says require_once(ABSPATH.’wp-settings.php’);.

If the directory that you are defining does not yet exist, WordPress will automatically create it as long as wp-content is writeable. Otherwise you can just go in and create the directory yourself via FTP. Make sure to make the new directory writeable. Change upload organization

You can also change the way WordPress uploads are organized. Navigate to Settings > Media in the dashboard and you’ll find the option to check or uncheck the box next to “Organize my uploads into month- and year-based folders”.

0
votes

The path you gave when doing chown is invalid. Paths are case sensitive.

Please also be aware there is a difference between chmod and chown.

Path should have been /Applications/XAMPP/xamppfiles/htdocs/migsmarbella.com

Run the following commands in terminal:

mkdir /Applications/XAMPP/xamppfiles/htdocs/migsmarblla.com/wp-content/uploads
sudo chown -R nobody:staff /Applications/XAMPP/xamppfiles/htdocs/migsmarblla.com/wp-content/uploads

The first creates an uploads folder since one doesn't already exist.

The second changes its ownership so folders can be created and files added by WP. Changing the ownership of the entire install will cause issues when you modify files. This only applies the change to the uploads dir.

0
votes

In the recent version on xampp-7.2.6 in mac osx, the lampp process is running as daemon user. And your wordpress folder might not have permissions to create the plugin folder in the directory. In order to resolve this issue, I changed the permissions of the webiste folder. chmow daemon -R website It worked.