PHP server-side scripting language

On this page:

About PHP

PHP is an open-source server-side scripting language with syntax similar to that of C and Perl; for more, see and At Indiana University, PHP version 7.1 is available on Webserve (,,,, and

You can use the PHP scripting language to create dynamic web pages; a dynamic page interacts with the user, so that each user visiting the page sees customized information. You can also use PHP to create dynamic web pages that are generated from information in a MySQL schema. PHP commands can be embedded within a standard HTML page.

PHP offers connectivity to most common databases. PHP also offers integration with various external libraries, so you can do anything from generating PDF documents to parsing XML.

Use PHP on Webserve

Keep the following in mind when using PHP on Webserve:

  • Bang lines are not required and will be ignored if present. (The previous web server environment required bang lines.)
  • Use .php as the file extension.
    • This refers only to PHP files executed directly via a URL. Include files may use other extensions, such as .inc.
    • If you have PHP files that currently use .php4 extensions, it is strongly recommended that you use .php instead.
  • The script must have owner execute permission. For best security, setting permissions to 700 (that is, read, write, and execute privileges for owner only) is strongly recommended.

    For example, where script.php is the name of the file containing the script, change the file permission as follows:

    chmod 700 script.php
  • Use /tmp or a subdirectory of /tmp as the location for temporary files such as session or cache files. This is the default location for PHP session files, but some frameworks may have different defaults. Do not use a directory within your account home directory (/ip/username) as the location for temporary files.

Specify PHP versions on Webserve

As of December 17, 2018, PHP 7.1 is the only version of PHP installed on Webserve. AddHandler directives are no longer necessary for PHP applications in .htaccess files.

The only valid AddHandler directives are:

<FilesMatch "\.php$">

    AddHandler x-httpd-php .php



<FilesMatch "\.php71$">

    AddHandler x-httpd-php7.1 .php71


Any other PHP directives will cause errors.


If you receive a "500 - Internal Server Error" message when running your scripts, check the following:

  1. Make sure the file permission is set to 700 (read, write, and execute for owner only).
  2. Make sure the directory (folder) permission is set to 711. Setting it to 777 will cause a "500 - Internal Server Error".
  3. If the file/directory permissions are set correctly and you still get a 500 error, it is likely due to line compatibility between the program used to create/upload the file and the Linux server. To fix this, log into the account on Webserve via an SSH client with a command line interface, and then do the following:
    1. Use cd to move to the directory where your PHP file is located (for example, cd www).
    2. Open the file using an editor (for example, nano), and then save it:
      Ctrl + o

      This converts Windows CR/LF (carriage return/line feed) to Unix LF (line feed) or Mac CR to Unix LF.

    To prevent this problem in the future, change the settings/preferences in the program you are using to develop PHP files. To set preferences in Dreamweaver, go to Edit > Preferences. Select Code Format or HTML Format, depending on the versions. Change Line Breaks to LF (Unix).

Sample PHP code

Place a file containing the code below inside the www directory of your Webserve account and save it as info.php:


To view the file, provide the web site address to the file. For example:

This will output information about the current state of PHP, which includes information about PHP compilation options and extensions, PHP version, server information and environment (if compiled as a module), PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP license. Because every system is set up differently, you can use phpinfo() to check configuration settings and for available predefined variables on a given system. For more, see phpinfo from

Increase the memory limit

You can increase the memory limit with a php.ini file in the same directory as your PHP script. If you have multiple subdirectories, you'll need to place the php.ini file in each subdirectory that has PHP scripts.

In the php.ini file, to specify the memory_limit you wish to set, use:

memory_limit = whatever integer you wish

To verify the memory_limit has changed, create a php info file.


For more about PHP, see:

This is document bfsu in the Knowledge Base.
Last modified on 2019-03-22 10:53:28.

Contact us

For help or to comment, email the UITS Support Center.