php.ini location?

aussielunix

Member
Registered
Joined
Aug 29, 2016
Messages
38
Points
8
I have error Fatal error: Allowed memory size...and following guides to fix this but I need to change memory_limit = 512M or higher in php.ini, but I don't know where is the location of my php.ini on my server? I am using cPanel.
 

FerdieQO

Well-known member
Joined
Jul 15, 2016
Messages
213
Points
28
In your Putty, login as root account and running this command

php -i | grep "Loaded Configuration File"
It should show you somethings like this

Code:
[root@yourvps ~]# php -i | grep "Loaded Configuration File"
Loaded Configuration File => /usr/local/lib/php.ini
And /usr/local/lib/ is the path where you can find out your php.ini file.

Hope that helped!
 

R Langley

Well-known member
Registered
Joined
Dec 12, 2016
Messages
205
Points
0
I have error Fatal error: Allowed memory size...and following guides to fix this but I need to change memory_limit = 512M or higher in php.ini, but I don't know where is the location of my php.ini on my server? I am using cPanel.
public_html/php.ini should be, do you have access to the WHM or is it like shared hosting cPanel?
 

energizedit

Well-known member
Registered
Joined
Dec 13, 2016
Messages
259
Points
18
If this is just for a cpanel account you can create it in your public_html directory. Just create a new file php.ini then edit it with the line memory_limit = 512M and save it. That should do the trick.
 

HostXNow

Well-known member
Hosting Provider
Registered
Joined
Nov 26, 2014
Messages
374
Points
28
Which service are you using? Web/Reseller or your own VPS/Dedicated server? If the former then you may not be able to override the hosts' fixed values, if the latter and you're using cPanel then you can quickly update the setting using PHP Configuration Editor where the location is different depending on whether using EasyApache 3 or EasyApache 4.
 

aussielunix

Member
Registered
Joined
Aug 29, 2016
Messages
38
Points
8
public_html/php.ini should be, do you have access to the WHM or is it like shared hosting cPanel?
I don't see php.ini file in my public_html, I can access WHM.

Which service are you using? Web/Reseller or your own VPS/Dedicated server? If the former then you may not be able to override the hosts' fixed values, if the latter and you're using cPanel then you can quickly update the setting using PHP Configuration Editor where the location is different depending on whether using EasyApache 3 or EasyApache 4.
I can edit values in php.ini via WHM? It's more convenient than using terminal or ssh.
 

Skylarkhosting

Well-known member
Registered
Joined
Dec 24, 2016
Messages
85
Points
8
php.ini should be located in root directory.

If you have access to .htaccess file, you can increase memory by adding following lines in it..

php_value upload_max_filesize 1000M
php_value post_max_size 2000M
php_value memory_limit 3000M
php_value max_execution_time 180
php_value max_input_time 180
Feel free to play around with sizes.
 

therohost

Member
Registered
Joined
Jan 1, 2017
Messages
39
Points
0
if you ar using cpanel cpanel you go tweak setting option and you see it php tab
 

Vishnu

Active member
Registered
Joined
Jan 3, 2017
Messages
77
Points
8
You can also use
locate filename.extension
locate php.ini

Which will show the php.ini location,This command can be used to find other files too !
 

Kieran2001

Well-known member
Registered
Joined
Mar 4, 2017
Messages
139
Points
18
Hello,

This depends on your hosting environments, shared clients should be able to modify it via CPanel from the php zone editor feature if provided. Although are unlikely to have direct access, the same applies for shared resellers.

However, the ability to change the php.ini files is completely up to your hosting provider, especially on a shared hosting services.

Did I satisfactorily answer your question? Don't forgot to leave me a thumbs up or 'thanks' :)

If I didn't please send me a message, so we can discuss any issues with my answer. If there's any additional questions, feel free to ask them in the thread, quoting me if necessary.

Best Regards,
Kieran Cairns
 

racksandcloud

Well-known member
Registered
Joined
May 18, 2017
Messages
89
Points
0
in cpanel, php.ini is located in /usr/local/lib/php.ini but it better you check with below command to find the loader php.ini

=======
$ php -i | grep php.ini
=======

you wont be able to edit this file or run the above command if you do not have root access to the server. If you have cpanel account access only, please use .htaccess to increase the memory limit. Which is also can restrict by the hosting provider. It would be better to open ticket to your hosting provider if .htaccess wont help.
 
Older Threads
Replies
12
Views
6,668
Replies
3
Views
2,439
Replies
13
Views
8,254
Replies
7
Views
3,100
Latest Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top