MX on Linux: Difference between revisions

168 bytes added ,  14:16, 6 September 2020
m
→‎Install PHP Hypertext Pre-processor: added location of batch php.ini
m (→‎Install PHP Hypertext Pre-processor: added location of batch php.ini)
Line 402: Line 402:
To test that php is installed, type <tt>php -v</tt> into terminal, and you will see the exact version that has been installed, a confirmation that it offers command line interface (cli), and a copyright notice.
To test that php is installed, type <tt>php -v</tt> into terminal, and you will see the exact version that has been installed, a confirmation that it offers command line interface (cli), and a copyright notice.


The main '''php.ini''' is found at ''/etc/php/7.n/apache2/php.ini'' (where 'n' depends on your Raspberry OS version and therefore which PHP version was installed, that was found out in last paragraph). Your own .ini file gets stored at ''/usr/lib/php/7.n/php-production.ini''.  
The main '''php.ini''' is found at ''/etc/php/7.n/apache2/php.ini'' (where 'n' depends on your Raspberry OS version and therefore which PHP version was installed, that was found out in last paragraph). You may need to edit this file for example to specify where your include files are stored (if not in same folder as script with require/include). Replace "apache2" by "cli" in the path for the batch php.ini file that you may also need to edit.


To run a php script in batch, type <tt>php - f <file_name></tt>. You can redirect the output by adding a greater than symbol and the destination file (i.e. > log_file) on the same terminal line.
To run a php script in batch, type <tt>php - f <file_name></tt>. You can redirect the output by adding a greater than symbol and the destination file (i.e. > log_file) on the same terminal line.
5,838

edits