The php.ini file is one of the essential configuration files in PHP. It serves as the file settings which allows you to control how your PHP works on different scenarios. Scenarios like File Uploads, Display Errors, Log Errors, and more.
So where is your php.ini file located? And what will you do if you don’t see one in your PHP directory? In this guide, you’ll learn the location and how to create a php.ini file so you can start to configure settings for your PHP program.
Where Is My php.Ini File
By default, you can locate your php.ini file at your public_html directory. But for some cases, you don’t see a php.ini file, you can create it manually. Continue reading this article to learn how to create it via your cPanel.
How to Create a php.Ini File
Important: There are standard PHP settings already set in the server, which your site uses by default. If you do not need to make any modifications to one or more of these settings, you do not need to create or change a php.ini file.
|Access your Hosting Manager.
|Scroll down to the Files tab, then click the File Manager option.
|Select the root directory for your site, the default for the primary is public_html.
|Click the + File button at the top menu of the page.
|A pop-up window will appear. In the New File Name field, enter php.ini as the file name. And enter /public_html to the New file will be created in the field. Then click the Create New File button.
|Right-click on the file you created and select the Edit option.
Or you can select the php.ini file and click the Edit button at the top
Another window will appear, click the Edit button.
It will direct you to the Text Editor page. From this point, you can input the configuration settings you want to your php.ini file. Click the Save Changes button, and click the Close button to close the Text Editor page.
Here is a sample of a php.ini file configuration:
You’ve successfully created your php.ini file in your directory. Please let us know if you need any further assistance, or if you have any questions. We’d love to help!