Solve the problem of displaying the FTP connection in WordPress 3.3 and earlier versions

Today, we have a solution to the problem of displaying the FTP connection that many bloggers suffer from, which is displaying the ftp connection page. I have an attempt to install an extension or template, and also when upgrading the blog. In fact, I had wanted to search for a solution to this problem for a while, but it did not allow me the opportunity. While browsing the technical support forum in WordPress, I found brother Wilf who fell into this problem, so I offered him to try a method that might work for him. Something and I felt this from his message, but this is the best thing. One knows who he deals with before the ax falls in the head. The important thing is to get to the heart of the matter without much talk and a special greeting to Brother Wilf

Problem: Displaying an FTP connection when installing plugins or templates

I recently solved this problem in a server for installing the mod_suphp library. This method may also work for you

FTP connection display problem

According to what I read in this article, Why WordPress Asks for Connection Info is that the problem lies in the inability to create a temporary file by the user, and this is due to the limited powers of the owner (owner), meaning that the script or the person who created this file does not have the authority to create this temporary file. I know (Don’t blame your brother, I didn’t study English, and they don’t matter, they grieve 🙂 The important thing is that I understand a little bit in the field) In this case, the WordPress files responsible for creating temporary files according to the nature of installation and upgrade are:


As for the file responsible for this problem, it is wp-admin/includes/file.php and exactly in the following code:

if( function_exists("getmyuid") && function_exists("fileowner") ){
	$temp_file = wp_tempnam();
	if ( getmyuid() == fileowner($temp_file) )
	$method = "direct";

The thing that maddened me is why Arabic hosts, with all due respect to them, prevent such a function, getmyuid, and God is absolutely crazy, sword mod is the cause of most problems in WordPress.From my point of view, some dangerous functions such as dl, exec and other dangerous functions that enable the hacker to execute direct commands to the system are disabled. I will not hide from you that the sword mod can be bypassed even if all functions are disabled, how can the hosting allow htaccess to be uploaded, and the sword mod will simply be bypassed

The important thing is that the above code uses four types to transfer files to the place designated for them from the tmp folder without problems with permissions. By the way, WordPress in this case uses wp-content as the tmp folder and the types are as follows:

Direct, SSH2, FTP PHP Extension, FTP Sockets

What concerns us here with regard to shared hosting are the two methods Direct and FTP that can be used. The important thing is now to move on to the solutions so as not to bore you

Solution: FTP connection display issue

Here we will use one of the methods we mentioned to transfer files without permission problems

As for the Direct method, it is used only if you are offered an FTP connection and you enter the information and nothing happens. Do not use it if you enter the FTP information and the installation and upgrade is done properly

All you have to do is open the wp-config.php file and add the following line:

define("FS_METHOD", "direct");

If it doesn’t work, create a folder called tmp inside the wp-content folder and give it permission 777 or 775 and add the following line to the wp-config.php file

define("WP_TEMP_DIR", ABSPATH . "wp-content/tmp");

Although you will only need to add the first code only for experience with the latest version

As for the FTP method, we use it only if it is possible to complete the upgrade currency after adding the password and password when displaying the connection page if you do not want to display this page

First, you must protect the wp-config.php file because you will put ftp information in it, and this is somewhat dangerous, but the file can be protected by adding the following code to htaccess

<Files wp-config.php>
 order allow,deny
 deny from all

After that, add the following code to the wp-config.php file:

define("FS_METHOD", "ftpsockets");
define("FTP_USER", "username");
define("FTP_PASS", "password");
define("FTP_HOST", "");

And that page will disappear, God willing, when installing or upgrading any add-on or template, as well as upgrading the blog

Important for the first solution was introduced in this post Direct plugin auto-update on WordPress 2.8

Solution 2: FTP connection display problem

This solution is used in the Add FTP Upgrade Fix because I could not disable the security situation and what I think the site Ala_khasahb account  creativity iPhone has not been activated php.ini in his account so I did the first experiment with the way did not work was the following message appears:

Downloading installation package from…

Unzipping the package…

I could not create the directory. /home/user/public_html/wp-content/upgrade/reliable-twitter.tmp

As for the second method, via ftp, it took a long time, and in the end it displays a message that the installation failed, as follows:

Downloading the installation package from…

Unzipping the package…

The add-on is being installed…

Incompatible archive.

An attempt to install the add-on failed.

The important thing in this case is that we install the FTP Upgrade Fix extension  in the normal way via Cpanel or FTP. After installing and activating it, you will be presented with a message as follows:You are running WordPress 3.2.1 which doesn’t need the FTP Upgrade Fix plugin. You can deactivate and delete the plugin.

Do not bother with a message, because we really need this plugin with our Arabic hosts, with all due respect to them. Edit the wp-config.php file and add only the following code:

define("FTP_USER", "username");
define("FTP_PASS", "password");
define("FTP_HOST", ""); // you can use localhost

Change the information to your FTP account and the problem will be solved, God willing


Frankly, I was amazed at a problem that the solution has been presented since version 2.8 and no one talked about it, knowing that I did a simple search in the Arab WordPress forum and did not find anything. Here we have finished this problem. I hope it will be a useful solution for you. See you in another post, God willing

Peace, mercy and blessings of God

Leave a Comment