Add A Simple Code In config.php

The solution is quite simple. I have added a single line of code in my wp-config.php file and it is working like a charm. The problem is solved and I am having no issue after adding this simple line of code in my WordPress wp-config.php file.

define('FS_METHOD','direct');
Then you may need to change the folder permission of the wordpress folder

But if you are having the problem is your main web hosting, you may try other methods that I have found on the internet. I am going to add them here for your future reference. Hope these will help you to solve the issue of “WordPress asking for FTP credentials on localhost”.

Not able to crate directory issue

 

After this, you may have issue with directory creation.

 

You will need to change the permission for wp-content with below command:

sudo chown apache wp-content/ -R