MX on Linux: Difference between revisions

826 bytes added ,  17:55, 5 September 2020
m
Line 394: Line 394:
== Install PHP Hypertext Pre-processor ==
== Install PHP Hypertext Pre-processor ==


PHP is not the only script language available, but it is quite comprehensive being able to be used either in a fairly simple way or in an object-oriented way for those trying to achieve more complex scripts.  The instruction to install it is <tt>sudo apt install php -y</tt>, which version you get depends on your Pi and its operating system.
PHP is not the only script language available, but it is quite comprehensive being able to be used either in a fairly simple way or in an object-oriented way for those trying to achieve more complex scripts.  The instruction to install it is <tt>sudo apt install php -y</tt>, which version you get depends on your Pi and its operating system. To check which modules have been installed type <tt>php -m</tt>. For PhpMyAdmin your php modules loaded (they are also listed in the .ini file, where unwanted ones can be commented out), must include at least mysqli and mbstring, I will say how to find the .ini files later.  


Alternatively, you can install <tt>sudo apt install</tt> particular php components, or a particular version by selecting components from a list like "<tt>php7-fpm php7-cgi php7-cli php7-common php7.3-mbstring php7.3-mysql php7.3-curl php7.3-gd php7.3-zip -y</tt>, only use this approach if you are short of space, and you are only going to use some of the php features.
Alternatively, you can install <tt>sudo apt install</tt> particular php modules, or a particular version, by selecting components from a list like "<tt>php7-fpm php7-cgi php7-cli php7-common php7.3-mbstring php7.3-mysql php7.3-curl php7.3-gd php7.3-zip -y</tt>, only use this approach to force a particular version (but you may find that is not available), or if you are short of space, and you are only going to use a minority of the php features available in the full set of modules.  


You may wish to create a index.php web page at /var/www/html which is the web server root for browsing, or of course you may wish to copy or FTP here all your existing web pages.
You may wish to create a index.php web page at /var/www/html which is the web server root for browsing, or of course you may wish to copy or FTP here all your existing web pages. To view a php web page, go into a browser and type in a url with the same IPv4 address as you use for the admin interface, omit the port (:8998) and instead type in your web page name (e.g. http://192.168.1.'''xy'''/index.php, where you need to determine digits that replace '''xy''').


The main php.ini is found at /etc/php/7.n/apache2/php.ini (where 'n' depends on your Raspberry OS version and therefore what PHP version gets installed). Your own .ini file gets stored at /usr/lib/php/7.n/php-production.ini. For PhpMyAdmin your php modules loaded in the .ini file need to include at least mysqli and mbstring.
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''.
 
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.


== Install Maria database ==
== Install Maria database ==
5,838

edits