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
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
For more information, see Encoding of Czech in documents .
Example PHP script
#!/packages/run/php/bin/php <html> <php echo strftime("%H:%M:%S\n"); ?> <html>
If you want to use FastCGI, edit v
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 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
To test the new version, change the first line in your scripts to:
/packages/run/php/bin/php then switch to the new version so you can change it
php-next back to
It is currently
7.2 while implicit
php is version
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
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 <html> 10:04:01 <html>
Examples of possible errors in case of unsuccessful startup
-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
Premature end of script headers(in
Check the header
Content-typeyou are listing correctly and followed by a blank line.
Security of 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.