Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the php.ini file in godaddy shared hosting linux

Tags:

php

I have a web, and running well on my localhost.

After I Upload on my godaddy hosting, My web got a bug. the conclusions is, I MUST change the memory_limit on the php.ini file, BUT cant find php.ini on FTP manager.

I have tried to:

  • Find the way for change to the Classing FTP manager.
  • Create / upload php.ini file from local and not work.

My Questions is : How I can Fix this? I Must change php.ini file. does anyone have experience like me?

like image 824
MudMan23 Avatar asked Apr 22 '13 06:04

MudMan23


People also ask

How do I access PHP ini in Linux?

To open the default php. ini file for editing, use one of the following commands (depending on which Linux distribution you're using): Ubuntu 16.04: sudo nano /etc/php/7.0/apache2. CentOS 7: sudo nano /etc/php.

Where is my PHP ini file Linux?

You can find the path to php. ini in the output of phpinfo() . See under "Loaded Configuration File".


4 Answers

Create php.ini file with your desired setting and upload it in your root folder of server. It will take effect with this new setting.

You can't edit the php.ini file of godaddy server, but you can upload your own copy of your php.ini with your new setting.

This new setting will be available only to you. Other websites will not be affected with this new setting.

Previously I faced the same issue, but after doing this my problem was resolved.

like image 152
Yogesh Suthar Avatar answered Sep 28 '22 10:09

Yogesh Suthar


Procedures:

  • Go to your CPanel
  • Select PHP version
  • Click on the link Switch to PHP options
  • Edit your configuration
  • don't forget to click save

enter image description here

You can also follow this screencast

https://www.youtube.com/watch?v=tdUlIkZcOe0

like image 25
Papouche Guinslyzinho Avatar answered Sep 28 '22 12:09

Papouche Guinslyzinho


As pointed out by @Jason, for most shared hosting environments, having a copy of php.ini file in your public_html directory works to override the system default settings. A great way to do this is by copying the hosting company's copy. Put this in a file, say copyini.php

<?php
  system("cp /path/to/php/conf/file/php.ini  /home/yourusername/public_html/php.ini");
?>

Get /path/to/php/conf/file/php.ini from the output of phpinfo(); in a file. Then in your ini file, make your amendments Delete all files created during this process (Apart from php.ini of course :-) )

like image 25
kakoma Avatar answered Sep 28 '22 10:09

kakoma


To check whether your php.ini file takes effect, open a plain text editor and create a file called phpinfo.php. Insert the following line:

<?php phpinfo(); ?>

Save this file to the root of your Web site and then browse to yourdomain.com/phpinfo.php to test the settings.

like image 34
chandresh_cool Avatar answered Sep 28 '22 11:09

chandresh_cool