Create a new php.ini file inside your wordpress root
To create a new php.ini
file inside your WordPress root, you can follow these steps:
Step 1: Create a new file
Using an FTP client (like FileZilla) or your hosting provider's file manager, create a new file inside your WordPress root directory (usually public_html
or www
).
Step 2: Name the file
Name the file php.ini
. Make sure to save it with the correct file extension (php.ini
, not php.ini.txt
).
Step 3: Add settings
Open the php.ini
file in a text editor (like Notepad or Sublime Text) and add the settings you want to configure. Here are some common settings you might want to adjust:
memory_limit
: Increase the memory limit to prevent PHP errors (e.g.,memory_limit = 256M
)max_execution_time
: Increase the maximum execution time for scripts (e.g.,max_execution_time = 300
)post_max_size
: Increase the maximum size of uploaded files (e.g.,post_max_size = 64M
)upload_max_filesize
: Increase the maximum size of individual uploaded files (e.g.,upload_max_filesize = 64M
)
Here's an example of what the file might look like:
memory_limit = 256M
max_execution_time = 300
post_max_size = 64M
upload_max_filesize = 64M
Step 4: Save and upload
Save the php.ini
file and upload it to your WordPress root directory using FTP or your hosting provider's file manager.
Step 5: Restart your web server
To apply the changes, you'll need to restart your web server. This will vary depending on your hosting provider or server setup. You can try restarting Apache or Nginx using the following commands:
- For Apache:
sudo service apache2 restart
(on Ubuntu-based systems) - For Nginx:
sudo service nginx restart
(on Ubuntu-based systems)
Step 6: Verify the changes
After restarting your web server, you can verify that the changes have taken effect by checking your WordPress site's PHP settings. You can do this by:
- Using the
phpinfo()
function in a PHP file (e.g.,phpinfo.php
) - Using a plugin like
WP PHP Info
orPHP Info
to display PHP settings in your WordPress dashboard
Remember to be cautious when modifying PHP settings, as they can affect the performance and security of your WordPress site.