WordPress is no far from errors but there are few common errors occur that can be fixed by using php.ini file. Php.ini is the file that can help fixing a lot of issues and one of the common is uploading file size.
A situation can be worse for beginner when s/he is able to upload small file size, but in an attempt to upload a larger file size it generates an error message: “file_name has failed to upload due to an error.”
We are going to discuss the possibilities to overcome this situation and exploring various solutions in this article. Let’s discuss an adequate way that will be suitable for all level of users.
Basically, to run a php based application, it requires to have a php.ini file. It helps controlling various functions like upload sizes, resources limit and timeouts.
If you go to the media manager section of your WordPress, you will discover the maximum file upload limit set for your website. However, it varies from one hosting provider to another. You may see some provider may offer 2MB as an upload limit and the other slight up and down.
Although, the 2MB restriction is perfect for images but it is clearly not sufficient when it comes to upload audio/video files. In this step by step guide, I will help you to overcome this situation and find various solutions and different levels.
Fixing global file using SSH
First off, you need to login to your SSH panel area by using the credentials you have given by the hosting company.
You can fix the global php.ini file to make it work correctly. php.ini file location varies on the OS, To find the php.ini file you may use the following command in your root directory
find -iname php.ini
Ones you find the file directory you may edit that file by Execute the below command at command prompt
Find the line upload_max_filesize and edit the value in front of it with your desire upload value in MB
save the file by typing
Once you are done, you can restart the Apache server.
By using WHM
The best part with the WHM is that you are allowed to use the PHP configuration editor. To make the php.ini file accessible to you to change the codes, it needs following steps.
- Login to your WHM panel as the root user. Now, you need to click on Service configuration button.
- This will open you the PHP configuration Editor. You need to open this too.
- After opening PHP configuration Editor, you will see a lot more number of parameters where the changes need to be made. These changes will affect the configuration and in case if you don’t see any parameter you can chose basic mode to edit the file.
- Now, you can click on advanced option too to explore long list of editable parameters. However, you just need to make the necessary codes only. By use of SSH you are always able to change the php.ini file.
- Once you have made the changes, now it’s time to click on “save” button.
Using Plesk Control Panel
The domain level php.ini file overrides the global php.ini file. In Plesk 11.0 and higher version, it offers to make necessary changes at domain level specific php.ini file.
You can use the Plesk Control Panel to edit and change the domain-level php.ini. You need to follow these simple steps.
- Click on Websites & Domains tab.
- Click on show more and select advanced option.
- Now click PHP setting menu.
- Select common options from drop-down menus when you need to modify this general option page. You can also create by using the option, “Custom Variable”.
- You can input the commands at the bottom of the screen to make it works.
- Now, click “Ok” and you are done with the necessary changes.
- When you are making changes to the global level, it affects the entire websites on that server since the global file means apply to all the websites on that particular server.
- If you want to change a single site from the global level, you can still accomplish that. You need to have a php.ini file at the website root level. Either you can create your own or ask the host to do this on behalf of you. This way changes will take effects for only that particular individual website you are wanting to.
Share this article in social media and help the community