Control PHP on a per domain basics

If you want to set PHP settings for a single domain you can use either an php.ini file or an .htaccess file. Both files use PHP directives to tell the server what to do.

INI File

You can use any plain text editor (Notepad, Notepad++, TextEdit, etc.) or the servers file manager to create a php.ini file.

In this example we will adjust the memory limit of PHP.

Once you have created your file and named it php.ini, add the following line of code to the file:

memory_limit = 32M

Save this file and place it in the root of the servers web content, for example where your home pages index file is. That’s it, there is no reboot required and the change should be noticed immediately after refreshing the page. For more information on your php.ini file click here.


The .htaccess file can also be created with any plain text editor or with the file manager.  The .htaccess files can do many things so when you want to set a PHP value, you must tell the server your addressing PHP valuess by adding php_value to your code.

This is done with the following line of code:

php_value memory_limit 32M

The .htaccess file is often hidden by default so make sure your file manager or FTP client has been set to display hidden files.


Was this article helpful?

Yes (3)
No (0)

We're sorry you didn't find this article very helpful. Please help us improve it by leaving your feedback below.