Easy WordPress Updates: Store FTP Info in wp-config.php

Saw an interesting blog post on Twitter today about storing WordPress FTP information in wp-config.php. The article was written in German so I sent the author an email to ask if he’d mind me translating it. Phil, the author, very kindly said yes – so my translation is below.

Since the addition of the automatic updates in the WordPress core became available, there has been the possibility of FTP data in the backend. Then you can get both plugins and the core by clicking on the date. However WordPress then stores the login information in the blog database. This can be a potential security issue. If someone were to gain access to your database then they would also have access to your entire server. One way of reducing the risk is to use the approach outlined below.

Editing wp-config.php

Access

The wp-config.php file can be used to define constant values so that the usage of a database can be removed. This makes the database smaller, and so improves site performance. For the FTP access the constants are as follows and should be added to the bottom of your wp-config.php file:

define(‘FTP_HOST‘, ‘ftp.example.org‘);define(‘FTP_HOST‘, ‘ftp.example.org:2121‘);define(‘FTP_USER‘, ‘username‘); define(‘FTP_PASS‘, ‘password‘);

Secure Connection

For a secure connection add the following line (default: false):

define(‘FTP_SSL‘, true);

Directories

If the WordPress installation is not in the root directory of the FTP server you can define the location as follows:

define(‘FTP_BASE‘,‘...‘);

Have you moved the plugin directory or all of the content folder? You can also specify the full path using these two constants:

define(‘FTP_CONTENT_DIR‘, ‘...‘);
define(‘FTP_PLUGIN_DIR‘, ‘...‘);

Method

Finally, you can also adjust the method to be used by WordPress for the file system. This often hides errors if something goes wrong with the file permissions. You should only change this value if errors occur, most of the time the default will work just fine.

define(‘FS_METHOD‘, ‘direct‘);

The following methods are possible:

  • direct (default) – PHP file system functions
  • ssh – SSH PHP Extension
  • ftpext – FTP PHP Extension
  • ftpsockets – PHP socket extension

The constants FTP_PUBKEY, FTP_PRIKEY display the paths to the SSH public key and private key SSH specify.

Delete existing data

If you’re unsure whether access data already stored on WordPress, you can search the WordPress options in the database using the following page on your website:

http://example.org/wp-admin/options.php

There you should search for the entry: ftp_credentials

If this is present, you have already stored the FTP data in your database. You can delete it by simply removing the value in the ftp_credentials field on the options page, then scrolling to the bottom, and pressing save. You should be very careful doing this though as there is potential for your website to be broken when doing this.

More information

Further Information can be in the WordPress Codex:

时间: 2024-07-31 14:33:37

Easy WordPress Updates: Store FTP Info in wp-config.php的相关文章

Automatic WordPress Updates Using FTP/FTPS or SSH

Introduction When working with WordPress in a more secure environment where websites are not entirely world-writable, you will notice upgrades request FTP or FTPS credentials as the server itself does not typically have write access in properly-confi

Install WordPress Plugins without FTP Access

WordPress will only prompt you for your FTP connection information while trying to install plugins or a wordpress update if it cannot write to /wp-content directly. Otherwise, if your web server has write access to the necessary files, it will take c

Centos 7 安装 Wordpress(二)-----安装 FTP

安装好了 Apache 后,我们就要上传文件了,所以需要使用 FTP ,默认的情况下,centos 是不开 VSFTPD 服务的,所以我们要安装与开通起来. 命令如下: #yum -y install vsftpd ftp   >>>>>我这里把 ftp vsftpd 都安装 安装成功后,我们要把它开起来,网上说默认的情况下是不打开的,不过我发觉我安装上去后,FTP 是默认打开了.不管怎么样,我们重复敲多一次命令就OK,确保它是打开的. 命令如下 : systemctl re

wordpress电子商务插件和主题的使用方法

前提步骤:卸载wordpress干净,需要把相应的数据库删除:drop databade **: (1)先改wordpress中重要文件的权限:777 (2)用usradd -d www /html命令添加www用户后,把该用户给wordpress:chown -R /html:www * (3)就可以安装相应插件和上传主题(不用FTP)了 1.woocommerce插件的使用: (1)设置->产品->显示->商店和产品页面->店铺页面:产品就可以显示在页面的主要部分了: (2)要

在使用WordPress建立商业网站时你需要了解的?

在玩WordPress的4年里,目睹WP的功能越来越强大的同时,也感受到了WordPress越来越臃肿复杂,不再是曾经众多博主所认为的简单易用,尤其对于很多完全陌生的新手来说,诸多WP专用的术语也一知半解,比如"自定义字段","自定义缩略图","自定义表单"--这么多的自定义也表明WordPress正逐渐走向一个强大的准CMS系统了,也正因为功能的强大和众多的开发者提供的资源,很多人开始选择用WordPress建立自己团队或者公司的垂直资讯网站或

WordPress 前端投稿/编辑插件 DJD Site Post(支持游客和已注册用户)

说到前端用户投稿,倡萌之前推荐过3个不错的插件: WordPress匿名投稿插件:DX-Contribute (有朋友反馈不能用) WordPress投稿插件:User Submitted Posts (貌似没有集成编辑器,编辑文章不是很方便) WordPress 前端用户中心插件:WP User Frontend (免费版功能不太齐全) 今天要给大家推荐的这个 WordPress 前端投稿/编辑插件 DJD Site Post,它不仅支持已注册用户投稿,还支持给匿名游客投稿,而且在投稿界面添加

WordPress 前端用户投稿插件 Frontend Publishing

关于前端投稿,倡萌已经分享过不少文章: WordPress添加投稿功能(无需注册/可邮件通知站长和投稿人) WordPress匿名投稿插件:DX-Contribute (有朋友反馈不能用) WordPress投稿插件:User Submitted Posts (貌似没有集成编辑器,编辑文章不是很方便) WordPress 前端用户中心插件:WP User Frontend (免费版功能不太齐全) WordPress 前端投稿/编辑插件 DJD Site Post(支持游客和已注册用户) 今天再分

Wordpress必备插件

AKismet:spam必杀插件(过滤垃圾评论) google xml sitemap插件 文章统计插件 WP-PostViews 页面导航插件:WP-PageNavi Simple Tags标签插件 Baidu Sitemap Generator Lc.Archivers(WP博客的无图版.简洁版) WordPress 相关日志插件:WordPress Related Posts 自动seo插件 WP Keyword Link

CentOS 7 yum安装lamp,三者位于不同服务器,并为之安装WordPress及phpmyadmin

系统平台:CentOS 7 1611 WordPress下载地址 phpMyAdmin下载地址(CentOS 7 建议不要安装最新版,否则需要编译最新的php-fpm) 分别在三台主机上安装httpd(192.168.1.200),php-fpm(192.168.1.201),mariadb(192.168.1.202), 并提供WordPress.phpMyAdmin应用 1.安装并配置httpd服务器     1.1 安装httpd服务    [[email protected] ~]# y