PHP settings that cannot be changed

PHP has been configured to use the following settings on our shared and reseller servers:

safe mode = Off (cannot adjust)
memory_limit = 256M (MAXIMUM)
max_execution_time = 30 (MAXIMUM)
max_input_time = 60 (MAXIMUM)
post_max_size = 64M (MAXIMUM)
upload_max_filesize = 64M (MAXIMUM)
enable_dl = Off (cannot adjust)

The above settings either CANNOT be changed or cannot be exceeded on a shared and reseller account. These limits are set to prevent extremely high resource usage in shared environments. We have found that a majority of the PHP scripts will work within these limits, and the scripts that require more resources are best suited for a VPS or dedicated server. Dedicated servers and VPS can change and raise these settings to any value desired.

We also set the following:

register_globals = On
magic_quotes_gpc = Off

These two settings, and any other PHP settings not aforementioned, can be changed using a custom php.ini file located in the same folder as the script that requires the settings.

NOTE HostGator cannot know why you want or need to change these settings. You are changing these at the advice of your webdesigner or the developer of your script. HostGator can only show you where to make the changes.

Article Comments

After installing Moodle using Fantastico, Moodle gives me this security warning:
To operate properly, Moodle requires
that you make certain changes to your current PHP settings.
You must set register_globals=off.
This setting is controlled by editing your php.ini, Apache/IIS
configuration or .htaccess file."

This conflicts with Hostgators setting: "register_globals = On".

Any comments on how to resolve this?


Yes, this article suggests you change the setting in your php.ini file.

If you cannot locate that file, or do not understand how to set "register_globals = Off", then please contact us via phone or live chat.

Is the ini_set function disabled? What happens if an application we have attempts to change these values? Is a php error printed, is the application killed, or is it silently ignored?

You can use ini_set to define memory limits and other settings in your script.

We have these limits in place, which may override your settings if you choose a value not allowed.

olariu romeo
I have an error in my site: Fatal error: Out of memory (allocated 46661632) (tried to allocate 15789244 bytes) it seems that we have not even 64MB these are only hypothetical i have a baby accaunt

HostGator allows a maximum of 64MB, but we do not set your account to that value.

You are in complete control of this setting via your php.ini file. Please increase the memory_limit line to equal 64M.

If you still have errors, please contact us via phone, live chat, or email for assistance.

Do you accept http uploads? Thanks.

Yes, http uploads are fine.

allow_url_fopen and allow_url_include, are these turned on?

No worries. You can control those settings and any others not specifically mentioned in this article.

For now, by default, those are both set to On.

In a VPS account, can I adjust max packet size to be bigger? max file size and max execution time were originally causing problems but now it seems to be packet size. I can't find that in the php configuration. Where can I adjust this?

That is not a php.ini setting. It is the max_allowed_packet setting in the my.cnf file.

Why can not running this PHP script bellow as on my PC?

<? $delfile=unlink("$gambar"); ?>

PHP coding is outside our scope of support. There could be many reasons why this line of code doesn't work, and out-of-context it is impossible to be sure.

I can tell you that the unlink() function is for deleting files, and must be passed a variable equal to a valid file path/name. Otherwise you will get an error like, "Warning: unlink() [function.unlink]: No such file or directory".

Here is a valid code....

<? $gambar = 'home.html';
$delfile=unlink("$gambar"); ?>

Why are "register_globals" settings enabled? I read that it is a major security risk!

Many PHP scripts rely on register_globals, and having this setting turned on is not a security risk.

A little research should reveal that professional PHP programmers prefer not to rely on register_globals so that their code must be very specific about variable names which are passed via EGPCS. (In other words, it is considered sloppy to write code which relies on register_globals.)

However, some software, like Drupal, warns you to turn register_globals off, and you should if that is the recommendation of the developer.

Where should I create php.ini file? Shall it go in public_html directory?

The same folder as the script that requires the settings.

Even easier, just contact HostGator via phone or live chat; we will create a php.ini file in your home directory and add an Apache directive to make it recursive (so it affects all of your directories).

Your comments help us keep the knowledge base updated. This is not a medium for support. If you have questions or need help, please contact us via email, phone or live chat for fast assistance.

Post Comment