Prevent WordPress from updating via FTP

Sometimes, you will have your WordPress installation on a server and you will not have the possibility to change the owner of the folders. Even if you change the writing and execution rights (chmod), if www-data is not the owner of the folder, you could have some issues updating automatically WordPress and your plugins. If your in this case, WordPress will probably ask you for the FTP credentials, and even with them, it could not managed to update.

Chmod rights

At first, you could think to change all your folders and files permissions to 775 instead of 755 and 644. For me, it didn’t worked. And even if it works, you would need to change them before and after each update, in other case you would have security issues.

WordPress FS_METHOD configuration constant

WordPress has a constant available to force to update without using FTP connection, but direct file I/O requests instead. You will need to add this constant to your wp-config.php file (at the end of file for example) with the value ‘direct‘.

As it is mentioned on the WordPress Codex, it’s sometimes due to the PHP extension and the configuration of the server :

Certain PHP installations shipped with a PHP FTP extension which is incompatible with certain FTP servers. Under these rare situations, you may need to define FS_METHOD to “ftpsockets”.

And here is the full documentation of the FS_method constant in the Codex :

FS_METHOD forces the filesystem method. It should only be “direct”, “ssh2”, “ftpext”, or “ftpsockets”. Generally, you should only change this if you are experiencing update problems. If you change it and it doesn’t help, change it back/remove it. Under most circumstances, setting it to ‘ftpsockets’ will work if the automatically chosen method does not. Note that your selection here has serious security implications. If you are not familiar with them, you should seek help before making a change.

  • (Primary Preference) “direct” forces it to use Direct File I/O requests from within PHP. It is the option chosen by default.
  • (Secondary Preference) “ssh2” is to force the usage of the SSH PHP Extension if installed
  • (3rd Preference) “ftpext” is to force the usage of the FTP PHP Extension for FTP Access, and finally
  • (4th Preference) “ftpsockets” utilises the PHP Sockets Class for FTP Access.

Source: Hongkiat

Customize and improve Terminal (Mac OS)

Today, I just wanted to share with you a simple way to customize your Terminal and improve its readability.

Color theme

First of all, I will recommand you to install a new theme for your Terminal. Of course, you can also customize it yourself, but there is already great themes available like this ones :

After choosing your theme, don’t forget to click on “Default” to enable this theme on every new Terminal window.

Font

The default font in Terminal is Andale Mono, which is a good font, but you could customize it. My favorite for this is Anonymous Pro, but of course you can choose your own, just be aware to choose a Monospace font.

Download Anonymous Pro

Increase size

Depending on the font you choose, you can increase its size, the way you like it. Personally, I choosed 14px for Anonymous Pro.

Bold fonts or antialias text

I would recommand you to check at least one of this two checkbox :

  • Use bold fonts
  • Antialias text

This will hightly improve the readability of your font, especially if your using a retina screen.

Improve the syntax coloration and ls command

We will change the syntax coloration of the Terminal and get something like this.

Customized Terminal screen
Customized Terminal screen

To do that, we will need to edit our .bash_profile file. To open this file, type this in your Terminal :

Or edit it directly with nano or vim.

Then, past this lines at the beginning of the file and save it.

That’s it, your ready to go! Open a new Terminal and start doing awesome stuff!

Source: OSXdaily