> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP script basics

> Master PHP basics with our guide featuring step-by-step instructions, code snippets, and links to related articles.

This article provides essential information about running PHP scripts on hosting.com servers.

## What permissions do I need to set for my PHP script files?

To avoid potential problems, you should set your PHP script file permissions to **755** (read, write, and execute permissions for the user, and read and execute permissions for the group and world).

## Do I need to add a header (shebang) at the top of my PHP script files?

No. You do not need to add a **#!/usr/bin/php** header (shebang) to your PHP script files.

## Can I use short tags in my PHP script files?

Yes, we have installed support for short tags with PHP. This means that you can write:

```
<? echo "Hello world"; ?>
```

... instead of:

```
<?php echo "Hello world"; ?>
```

## What is the path to the PHP executable?

The absolute path to the PHP executable on hosting.com's servers is */usr/bin/php*. The */usr/bin* directory is in the default path, so generally you do not need to include the full path when you run PHP scripts from the command line. Just type the following command, replacing *filename* with the name of your script file:

```bash theme={null}
php filename
```

<Tip>
  To change the PHP version that your account uses (both on the web server and from the command line), use the PHP Selector in cPanel. For information about how to use the PHP Selector, please see [this article](/docs/changing-php-versions-and-settings-in-cpanel).
</Tip>

## What version of PHP is installed on my account?

Currently, you can use PHP version 5.6, 7.1-7.4, or 8.0-8.4.

* To determine the command-line PHP version currently installed on your account, type the following command at the command prompt:

  ```bash theme={null}
  php -v
  ```

* To determine the PHP version that the web server uses to process web pages on your site, log in to cPanel, and in the **Software** section of the home screen, click **Select PHP Version**. You can also change the PHP version that the web server uses for web site files on this page.

<Note>
  On an unmanaged VPS or dedicated server, you can install any version of PHP that you want.
</Note>

## What file extensions can I use for my PHP script files?

The default file extension for PHP script files is **.php**. However, you can define additional PHP script file extensions in an *.htaccess* file. For example, the following line demonstrates how to define the file extension *.html* for PHP script files:

```
AddHandler application/x-httpd-lsphp .html
```

<Warning>
  **Important**

  The **AddHandler** directive above works with most Managed plans as well as plans with root access.
</Warning>

For more information about how to use *.htaccess* files, please see [this article](/docs/using-htaccess-files).

## Do you run PHP in safe mode?

No, we do not run PHP on our shared servers with **safe\_mode** enabled, because it can cause issues for scripts. Additionally, safe mode was deprecated in PHP 5.3.0, and completely removed in PHP 5.4.0.

## More information

For more information about PHP, please visit [http://www.php.net](http://www.php.net).

## Related articles

[Configuring file permissions in File Manager](/docs/file-permissions)
