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 MySQL on CentOS 7

Welcome back to shortlearner.com, in our previous post we learn How to Install PHP on CentOS.
now today in this post we will see how to install MySQL on CentOS.
before going to installation process we just take an overview of CentOS and MySQL.

install mysql in centos

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.

Also Read :
How to integrate Razorpay Payment Gateway using PHP.
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.?

MySQL open-source tool and Database Management System. MySQL is a fast, stable, true multi-user, multi-threaded SQL database server.
Apart from the free edition, MySQL also offers other services like MySQL Enterprise Edition, MySQL Cluster CGE, Oracle MySQL Cloud Service and MySQL for OEM/ISV.

Drupal, Joomla, phpBB, and WordPress are some examples of MySQL database-driven web application.
Facebook, Flickr,MediaWiki, Twitter and YouTube are some examples of MySQL database–driven websites.

Install MySQL 8.0:

If you choose MySQL 8.0 for installation on CentOS 7. You can follow the below commands for installation.

First, We need to Enable the MySQL 8.0 Repository Package because MySQL 8.0 is not a default package in CentOS 7. Use the below command to enable for local installation

Now the MySQL 8.0 Repository Package got enabled in the CentOS. We can directly install the package using below mentioned command.

don’t forgot to verify the signature key , it is the most important thing to do. For a specific package, we need to obtain a copy of public GPG build key. While installation it will be asked for key permission. so just type Y and hit the enter button.

After installation of MySQL:

1) Enabling the MySQL Service:

so the steps are mentioned below is same for any version of MySQL. so just follow the below steps one by one.

First , we need to enable mysqld . which will help to run the MySQL package in background during the boot time. Use below command for enabling the server.

after enabling the server we need to start the server for the connectivity by using the below command.

now we need to check with the status of the server for its operating status. we can use below command to check the status in the output terminal – Status: SERVER_OPERATING

2) Securing your Credentials:

For the first time when we start with our MySQL server, we will have default password in the MySQL server root user. we can locate the default password by using below command.

In the output our default password will be displayed. Remember the default password, will will help to login in further steps.

To enhance the security of the MySQL installation, use below command

When we execute the above command, it will be asked for a password. we need to enter our password there.

After this, we need to enter our own password.
For secure password: 8 Char length, 1 upper case, 1 lowercase, 1 special character, and 1 Numeric char.
Now the MySQL server will ask some questions regarding Access, User Permission, remove the database. so just type Y and hit the enter button for all questions.

3) Login Setup to Your MySQL Server:

We all set with our credentials , we are ready to login to the MySQL Server. For that we need to enter into the root of MySQL server. we can enter below command to get into the root.

Once we entered into the root, we will be asked for our own password, which we created in previous steps.

4) Database and Table Creation:

We all set with the MySQL server. To create the database, we can use below command.

We created our database, now we can get into our database using the following command.

Below is the simple structure of table creation.

Read and display the text file using javascript

Welcome back to shortlerner.com, in our previous post we was learn How to Send Attachment With Email with the help of PHP. today in this post we will see how to read and display a text file data into html text area tag with the help of JavaScript.

Read and display the text file using javascript

so here we are creating a file tag where user upload the text file and there is another html form element text area.

so whenever user upload the file we use some JavaScript functions which will read the file and display all the data of the file inside the text area.

Also Read :
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.?

simply just copy the above code and put it on your root directory.
hope this post will helps you, if you still facing some bugs or error to than feel free to contact.

thanks for reading the post and please share this code with your developer buddy.

keep coding , keep learning

Send Attachment With Email using php

Welcome back to shortlearner.com, in our previous post we learn how to add pagination using PHP and MySQL. so today in this post we will see how to Send Attachment With Email using php.

so first of all we should take an overview of our working scenario.
in the below code we are created a form with having email, subject,message and attachment fields.

once the form is submitted our script is check that the file’s format is valid or not.
if the file format is valid than the attachment is concatenate with our message field and with the help of MIME (Multipurpose Internet Mail Extensions) version and its content type and boundary.

we will send the attachment. once the mail is send successfully our script will display the success message and if the mail isn’t sent than it will display failure message as well.

send email with attachment in php

Also Read :
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.?

guys this code is not works on local server like xampp,wamp and appserv. so try it on live server.

delete multiple records using checkbox php

Welcome back to shortlearner.com, in our previous post we learn How to Create pagination using php and mysql . now in this post we will learn how to delete multiple records using checkbox with the help of PHP and MySQL.

delete multiple records in PHP

before start this tutorial first of all we should understand the overall scenario of this post.
now first of all we need to create a database connection , so in this example my database name is testdb .

after creating a database connection we fetch all the records from our user table and designed it in a tabular format with checkbox field, and also create a java script function that will help us to select all check boxes at a time.
so just follow the below code.

Also Read :
Get Domain name from URL
Unable to create a directory a wordpress error
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.?

copy the above code and save it on htdocs directory of your xampp server.
there is a www folder if you are using WAMP or Appserv local server.

share this code with your developer buddies and if you have another way to make it simple ,please feel free to contact we will update your method also in this post.

keep coding, keep learning