translated by Google

Instructions for use on PHP on FI

First, go to our directory /home/xlogin/public_html create a file .htaccess (must have "r" access for others). Let's note that .php files are scripts and run as scripts:

DirectoryIndex index.php
AddHandler cgi-script .php
AddType application/x-httpd-php .php

In order for the PHP script to run, it must have "x" access for the owner (PHP scripts are triggered under your identity).

If you have a Web site management right on Aise, located elsewhere than below /home/xlogin/public_html/ , these PHP scripts need to allow "x" access for users apachefi , otherwise they will not work. Adding this right is ideally possible with the command

setfacl -m u:apachefi:x soubor.php

Furthermore, its first line must be a string #!/packages/run/php/bin/php . It is not necessary to insert this string into files that do not run directly, but for example they are only inserted with include .


The default encoding is set to UTF-8 , which applications should use both for program code and for possible HTML files.

In special cases, you can set encoding in PHP (eg ISO8829-2 ) by adding this command to the beginning of the program:

<?php ini_set('default_charset', 'ISO8859-2'); >

HTML files can be set to encode in a file .htaccess :

AddDefaultCharset ISO-8829-2

For more information, see Encoding of Czech in documents .

Example PHP script

  echo strftime("%H:%M:%S\n");


If you want to use FastCGI, edit v .htaccess directive AddHandler :

DirectoryIndex index.php
AddHandler fastcgi-script .php
AddType application/x-httpd-php .php

FastCGI scripts are not re-launched at each request, but serve them more. This may cause an accelerated response of the application, but on the other hand not all applications are ready for this mode of use.

PHP Upgrades

PHP language is constantly evolving and old versions are no longer supported, so we need to upgrade once in a while to a newer, usually incompatible, version. To simplify your upgrade preparation, the new PHP version is accessible under the name /packages/run/php/bin/php-next .

To test the new version, change the first line in your scripts to:


Implicit /packages/run/php/bin/php then switch to the new version so you can change it php-next back to php .

It is currently php-next version 7.2 while implicit php is version 5.6 .

How to deal with problems

A useful resource for more detailed error information is the Apache logs. They can be found on the Aisa server located in /var/log/httpd/ , specifically error.log , eventually suexec.apachefi.log .

When debugging, it is also preferable to use CGI instead of FastCGI. The error logs are then clearer, and running the script over the web is more responsive.

The PHP script should also be directly executable on the command line. Correct Output Example:

aisa:/home/xlogin/public_html>$ ./index.php
X-Powered-By: PHP/5.6.38
Content-type: text/html; charset=UTF-8


Examples of possible errors in case of unsuccessful startup index.php :

  • -bash: ./index.php: Permission denied
    The PHP script apparently does not allow "x" access for the owner.

  • -bash: ./index.php: /packages/run/php/bin/php^M: bad interpreter: No such file or directory
    The PHP script has DOS line breaks. Unix line breaks can be converted to a utility dos2unix .

  • Premature end of script headers (in error_log file)
    Check the header Content-type you are listing correctly and followed by a blank line.

Security of error logs

Error logs are readable to users only xlogin , under which the script is running.

You can also consider logging errors into your own file. This can be accomplished by creating your own PHP configuration file .user.ini , which you place in the directory public_html . This file should have at least the "r" access right for the owner and should contain a line

error_log = /home/xlogin/php.log

Consequently, the error messages should be logged in the file. Of course, it is advisable to secure this file before accessing other users. Therefore, we recommend that you create this file manually with the appropriate permissions, otherwise you will be created with read permissions when writing the first error. At least the right is required w for owner and file path should be accessible to you - Logging takes place again under your identity. Alternatively, if the directory in which you want to save this file is accessible only to you (right x only for the owner), you can have the file created automatically.