Unable to create directory Error in WordPress

Welcome back to shortlearner.com, in our previous post we will see how to install WordPress in CentOS.
In this post today we will see how to fix the unable to create directory error in WordPress.

unable to create directory in wordpress

so i recently i was working on a WordPress based project so when i try to upload/import media into WordPress’s media library then i got some kind of error ,which are mentioned below.
this tutorial is for you. It will show you how to fix this annoying error.

Also Read :
Get Domain name from URL
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

  • Unable to create directory wp-contents/uploads
  • not able to create directory/ wp-contents/uploads/ Is its parent direcotry writable by the server.?
  • Unable to create directory wp-contents/uploads/2020/07

There are a few different possibilities for this error to show up. I will try to cover all the possibilities so hopefully one of them will help you fix the issue.

1: Update/Change the Uploads Directory Settings

this is one of the easiest way to fix that kind of errors. i personally recommend to follow these steps if you have an error like that.

  1. Log into your WordPress admin dashboard.
  2. Go to Media which are inside the Settings menu (Settings -> Media).
  3. Enter wp-content/uploads in the text box.
  4. Save the changes by hitting the “Save Changes” button and you are done.
Unable to create directory Error

2. Manually Change the Folder Permission

if the above method is not working for you don’t worry about it.
we have one another trick to handle this kind of annoying errors.
just follow the below steps and change the folder permission.

  1. Change folder permissions on the wp-content directory to 775 and try the upload again
  2. If it fails, change the permissions to 777 and try again
  3. if it still fails then do step 1 and 2 for the “wp-content/uploads” directory too

Once you can successfully create the folder and upload the media, be sure to return the permissions on wp-content directory to 755 (your folders should have a permission of 755 for security reasons).

Unable to create directory wp-content/uploads

How to Install PHP on CentOS

Welcome back to shortlearner.com, so today we are starting a new tutorial category in our learning platform.
in our previous post we learn how to implement Razorpay payment gateway with the help of PHP.
so in this post today we will learn how to Install PHP on CentOS. before start this tutorial first of all we should take an small overview about CentOS and PHP.

install php on centos

we all know about PHP is a server side scripting language which stands for hyper text processor. mostly PHP is used from web based software, its easy to learn.
CentOS is a Community Enterprise Operating System. It is an open-source platform for non-productive developmental work.


For production concern, those works can be migrated to RHEL (Red Hat Enterprise Linux) Linux distribution platform.
so in this post we will learn to install the PHP version 5.6. which is most popular PHP version.


In our next article we see how to install PHP My Admin and MySQL in CentOS.
Let’s see some features about PHP version 5.6
Reduced Memory
due to the reuse of php://input. Numeric, String and constant have scalar expression.
A constant array can use constant keywords.
PHP 5.6 can be used for command-line scripting.
Graphical user interface application can also be used by clients.
It has advanced protection patches.

Before Installation

Please make sure that remi:repo file was enable. i.e Enable=1 (inside remi:repo file) .Next point is to check the package was having required version for installation .
Step1:
Type the below command to install the rpm release packages. This will help you to install the packages of PHP version you wish to install.

Step2: now we are install utils. This will provide user with advanced package management options.
So that no manual configuration required for enabling and disabling the packages. For this, install utils command given below.

Also Read :
How to Install MySQL in CentOS.
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

Enter Y after the utils command execution completed.
Step3 : In the next step we will be the most important program provided by utilities is configuration manager, through which the activation of ‘Remi repository’ will happen.
This will be the default manipulating repository settings provided by utilities. which is help us to install any version of PHP.

In the end of command you can see two digits, which represents the version number.Eg: 56 for PHP 5.6 , 74 for PHP 7.4Below command will enable you the selected version.

Step4: We are going to install the PHP of required version. You can use any extension from the list given below with respect to your library files.


Finally, To make sure that you have enabled correct version, use below command and check the version.

After Installation of PHP:

To check the installation, First you can restart your apache package, using below command.

Get Domain Name from URL in PHP

Welcome back to shortlearner.com, in our previous post we learn how to send an attachment with the help of PHP and MySQL. today in this post we learn how to Get Domain Name from URL in PHP.

fetch domain name from url

so Recently I am working on one of my clients project and i need to fetch the domain name from the URL. This is a very small task but it is very useful stuff to learn.

Also Read
How to Install PHP on CentOS.
How to integrate Razorpay Payment Gateway using PHP.

PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

In this short article, We will write simple and easy code to get the domain name from URL by using some predefined PHP function.

First we need to parse URL using parse_url(). so we can get the array from parse URL and now we can fetch the specific host from the array using $parse[‘host’].

so in the below example we will find the domain name from a predefined URL which are in our $url variable. so copy the below code and run it on your server so you will found the domain name from a long URL.

Razorpay Payment Gateway Integration using PHP

Welcome back to shortlearner.com, in this post we will see how to implement Razorpay payment gateway with the help of PHP and CURL.

Razorpay is very popular payment gateway which provides all the clean, fast, secure payments services with hassle free integration.

Razorpay payment gateway in php

It allows online business to accept and process payments ,payments modes like including major Credit Cards, Debit Cards, Net-banking, Wallets & UPI. With the easiest integration, completely online onboarding, feature filled checkout and best in class performance, quickly go live with Razorpay and experience the future of payments.


Also Read :
Get Domain name from URL
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

so readers please just follow the below steps for implementing payment gateway in very easy way.

Create Account and Integrate Payment Gateway

  • At first Create Account.
  • After successful sign up and generate Key ID and Secret Key
Razorpay Payment Gateway Integration using PHP

Razorpay Payment Gateway features:

  • Accept All the payment methods like debit card, credit card, netbanking,UPI and wallets.
  • Razorpay payment gateway is very safe and secure
  • Easy to integration
  • Payment gateway kit available on multiple programming language
  • UPI and Multi Bank EMI options

Before starts to implement the Razorpay Payment Gateway Integration using PHP with cURL, look files structure, we are splits the process in several parts so it will be easy to understand the overall developing process.
Step1: Create a file constants.php and define Key ID and Secret Key

Note:please guys never share your secret key to anyone.

Step 2: Create another php file named index.php

in the below index.php code , we are declaring amount , currency , success URL and failure URL into some hidden input tags. so it will automatic redirect to success or failure page according to there response status.

Step 3: Create a file named callback.php
The file handles the payment process.

Step 4: Put the below script code in index.php file
We will use the chekout.js of Razorpay payment gateway for deduction of payment.

Step 5: now in the second last step we are creating a success.php file
so if transaction status is success than success.php page will show the message of transaction success.

Step 6: Create a file named failed.php

Create header.php and footer.php section of the web page.

footer.php

Copy Text From One Field To Another using JavaScript

Welcome back to shortlearner.com, in our previous post we learn how to read and display a txt file with the help of JavaScript.
today in this post we will see how to Copy Text From One Field To Another using JavaScript.

Copy Text From One Field To Another using  JavaScript

Also Read :
Get Domain name from URL
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Unable to create a directory a wordpress error
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

so most of the time we need to Copy Text From One Field To Another using Check Box with JavaScript.

for example if we are creating an e-commerce platform and we want to make it user friendly.

so we are creating a check box which will hep user to copy all the fields of billing address to shipping address.

in the below example there are two buyers , buyer 1 and buyer 2.
we take name, email and contact number information from buyer 1 and put it into buyer 2 by clicking on the checkbox

hope this post will help you.
keep coding, keep learning