欢迎光临
我们一直在努力

让wordpress自动升级Putting FTP Info in wp-config.php to Ease

Are you hosting your WordPress sites on one of those hosts where WordPress asks you to provide FTP details before upgrading itself or upgrading plugins? So when you click to do an upgrade, instead of just launching into it, you get a screen like this instead:

 

I don’t have experience with loads and loads of different hosts, but I can tell you that when hosting on Media Temple (gs), upgrades generally “just work”, but if you are using their more powerful (dv) service (which I *definitely* recommend), you’ll run into the FTP thing.

A while back, Joost De Valk had the same problem and created a plugin that helped him and may help you. As he explains it:

Filesystem access is available, the files are owned by me, but the webserver doesn’t run as me, and thus, WordPress doesn’t detect the automatic update correcly.

The core of the issue is that when WordPress does these upgrades for you on your behalf, it is the server that is doing the work, which runs as the ‘apache’ user. By default, at least on the (dv) server, the ‘apache’ user doesn’t have write access to your web directories.

Media Temple has an article (Run PHP with FastCGI) with a potential solution.

Because of the ownership that Plesk assigns to your website files and directories, Apache does not have permission to write to your web directories by default. This can cause permission errors in some applications – for example, a PHP upload script.

And SO ANYWAY…

If you just want to fix it and not fiddle with plugins or fancy server altering techniques, the easiest way is just to provide your FTP details. You can do that as WordPress asks you for them. Or to save yourself the hassle, you can provide these details in your wp-config.php file and auto upgrading will be back to “just working”.

Here is the full set of things you can define as per the Codex:

[code]

define(‘FS_METHOD’, ‘ftpext’);

define(‘FTP_BASE’, ‘/path/to/wordpress/’);

define(‘FTP_CONTENT_DIR’, ‘/path/to/wordpress/wp-content/’);

define(‘FTP_PLUGIN_DIR ‘, ‘/path/to/wordpress/wp-content/plugins/’);

define(‘FTP_PUBKEY’, ‘/home/username/.ssh/id_rsa.pub’);

define(‘FTP_PRIKEY’, ‘/home/username/.ssh/id_rsa’);

define(‘FTP_USER’, ‘username’);

define(‘FTP_PASS’, ‘password’);

define(‘FTP_HOST’, ‘ftp.example.org’);

define(‘FTP_SSL’, false);

[/code]

However, I only needed these to get mine to work:

[code]

define(‘FS_METHOD’, ‘ftpext’);

define(‘FTP_BASE’, ‘/var/www/vhosts/chriscoyier.net/httpdocs/’);

define(‘FTP_USER’, ‘username’);

define(‘FTP_PASS’, ‘password’);

define(‘FTP_HOST’, ‘host’);

define(‘FTP_SSL’, false);

[/code]

If you have trouble getting the full set to work, definitely try paring back to my trimmed down example.

 

来源:http://digwp.com/2010/11/ftp-in-wpconfig/

赞(0) 打赏
未经允许不得转载:席天卷地个人博客 » 让wordpress自动升级Putting FTP Info in wp-config.php to Ease
分享到: 更多 (0)
标签:

评论 抢沙发

评论前必须登录!

 

QQ :13945502电话:13913571631

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

×
订阅图标按钮