How do I use PHP scripts?
Our Web hosting service allows you to use scripts created in the PHP programming language.
On this page:
- Installing a PHP script
- Using the script you installed
- Sending email
- PHP versions and phpinfo()
- Changing php.ini settings
- PHP memory limits
- Can I use PEAR packages?
- Can I use Zend Optimizer or ionCube Loader?
Installing a PHP script
To install a PHP script, just follow these two rules:
- Name your PHP script so that it ends in ".php". For example, you could call a search script "search.php". (If you name a PHP script "index.php" and place it in a directory that does not contain an "index.html" or "index.htm" file, the PHP script will be displayed as the default file for that directory.)
- Use your FTP program to upload the script file in text (or "ASCII") mode, not "binary" mode. Although text mode is the default for most FTP programs, your PHP script may not work if accidentally uploaded in binary mode, so it's wise to check. Text mode is sometimes called "ASCII mode".
Using the script you installed
When your PHP script is installed, you'll be able to access it just like any other Web page. For example, if you named your script "search.php" and placed it in the top level of your website, you would access it as:
If you send email from a PHP script, you'll probably want to make sure your script sets the correct "bounce" address.
PHP versions and phpinfo()
We currently offer several different versions of PHP:
- PHP 7.2.18 (view phpinfo)
- PHP 7.1.29 (view phpinfo)
- PHP 7.0.33 (view phpinfo)
- PHP 5.6.40 (view phpinfo)
Our default PHP version for new accounts is PHP 7.3.5. You can use our “My Account” control panel to choose which version your site uses.
Click “view phpinfo” to see the default settings for each. Remember that you can override most of these settings; the sample page is useful for showing what modules we have installed and what defaults we use.
Changing php.ini settings
Certain aspects of the way PHP works are controlled through the server's “php.ini” file. For the most part, we use the default php.ini settings provided by the PHP authors.
We allow our customers to change these settings if they wish. To do so:
- Login to the customer control panel
- Click PHP Settings
- Add the PHP settings you wish to override in the box in the “Custom php.ini Settings” section
- Click Save Settings
For example, if you wanted to change the default time zone that PHP uses, you could add this new line in that box:
date.timezone = "America/New_York"
Or if you need to force your scripts to send only secure cookies PCI compliance reasons, you could add:
session.cookie_secure = 1
PHP memory limits
Our default PHP
memory_limit is 350 MB of RAM for PHP 5.6 and later. In the unlikely event that your PHP script requires more than that, you can increase it by placing this type of line in the "php.ini" settings:
memory_limit = 400M
However, you won't be able to increase it beyond the individual script memory limit shown on our Script Policies page — and in fact, it should be at least 100 MB less than shown there, because PHP itself uses some memory. If you try to go beyond that, the server will silently "kill" your script. It's better to keep the PHP
memory_limit lower so that PHP shows a useful error message if a bug causes your script to use too much memory.
Can I use PEAR packages?
PEAR packages are files that contain prewritten PHP code. Some scripts use PEAR packages to perform tasks such as connecting to a database.
We do support PEAR, with many PEAR packages preinstalled. See our PEAR support page for more details.
Can I use Zend Optimizer or ionCube Loader?
Copyright © 2000-2019 Tiger Technologies LLC