translated by Google

Machine-translated page for increased accessibility for English questioners.

How to use PHP on FI

First get to our directory /home/xlogin/public_html create a file .htaccess (must have "r" access for others). Here we will state that files with the .php extension are scripts and that they should be executed as scripts:

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

To run a PHP script, it must have "x" access enabled for the owner (PHP scripts run under your identity).

In the event that you have the right to administer Aise, which is located elsewhere than below /home/xlogin/public_html/ , you need to allow "x" user access for these PHP scripts apachefi otherwise they will not work. Adding this right is ideally accomplished with the command

setfacl -m u:apachefi:x soubor.php

Furthermore, its very first line must be a string #!/packages/run/php/bin/php . This string does not need to be inserted into files that do not run directly, but are only inserted with include .

Example of a PHP script

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


To use FastCGI, edit in .htaccess directive AddHandler :

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

FastCGI scripts are not newly run on every request, but serve more. This may result in an accelerated response of the application, but not all applications are ready for use.

PHP Upgrades

PHP is constantly evolving and old versions are no longer supported, so we need to upgrade from time to time to a newer, usually backwards-compatible, version. To simplify your preparation for the upgrade, the new version of PHP is available 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 we'll switch to the new version so you can change it php-next back to php .

Do not use a specific version of PHP (e.g. /packages/run.64/php-7.3.2/bin/php-cgi ) may be canceled at any time without notice.

Currently it is php-next version 7.4 , while implicit php is version 7.3 .


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

In special cases, you can set up 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 Coding of Czech in documents .

What to do in case of problems

Apache logs are a useful source of more detailed information about errors. They can be found on the Aisa server located at /var/log/httpd/ specifically error.log , eventual suexec.apachefi.log .

It is also preferable to use CGI instead of FastCGI when debugging errors. The error logs are clearer and the script running over the web is more responsive.

The PHP script should also be directly executable in the command line. Example of correct output:

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 does not seem to have "x" access enabled 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 endings. It can be converted to Unix line endings by the utility dos2unix .

  • Premature end of script headers (in error_log file)
    Check the header Content-type you write correctly and whether it is followed by an empty line.

  • End of script output before headers (in error_log file)
    Make sure you meet conditions required by suexec, especially script access rights

Security of error logs

Error logs are read only by the user xlogin under which the script runs.

In addition, you may consider logging errors into your own file. You can do this by creating your own PHP configuration file .user.ini that you place in the directory public_html . This file should have at least "r" access right for the owner and include a line

error_log = /home/xlogin/php.log

Subsequently, the error messages should be recorded in the specified file. Of course, it is advisable to secure this file from other users' access. Therefore, we recommend that you create this file manually with the appropriate rights, otherwise, when you write the first error, it is created with read rights to everyone. At least the right is required w the owner and file path should be accessible to you - logging is again under your identity. Alternatively, if the directory in which you want to store this file is accessible only to you (right x owner only), you can have the file created automatically.