Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lde-for-ubuntu [2025/12/08 08:05] – kkaragozlde-for-ubuntu [2025/12/08 09:48] (current) – [Installing PHP and Required Modules] kkaragoz
Line 1: Line 1:
-===== Installing Tools =====+===== Installing Core Dependencies ===== 
 +This step installs essential utilities needed for subsequent installations.
 <code bash> <code bash>
-sudo apt install zip unzip software-properties-common+sudo apt update && sudo apt upgrade -y 
 +sudo apt install zip unzip software-properties-common wget curl ca-certificates -y
 </code> </code>
  
-=====PHP installation===== +===== PHP Installation (Specified: PHP 8.4) ===== 
-Installing PHP's versions and libraries are pretty easy with the Ondrej Sury's personal package archive (PPA). I will install PHP 8.4 for this guide, but you can check which PHP version you want to install from the following page: [[https://launchpad.net/~ondrej/+archive/ubuntu/php|https://launchpad.net/~ondrej/+archive/ubuntu/php]]+The **Ondrej Sury PPA** is used for installing and managing PHP versions. We will target **PHP 8.4** as specified. You can check the available versions and their support status on the official PPA page: [[https://launchpad.net/~ondrej/+archive/ubuntu/php|ondrej/php PPA]]
  
 ==== Adding Repository ==== ==== Adding Repository ====
 +The PPA must be added to your system's sources list.
 <code bash> <code bash>
-sudo add-apt-repository ppa:ondrej/php+sudo add-apt-repository ppa:ondrej/php -y 
 +sudo apt update
 </code> </code>
  
-After adding the repository successfully, we can update the system.+==== Installing PHP and Required Modules ==== 
 + 
 +DokuWiki requires specific PHP modules (extensions). The following command installs PHP 8.4 alongside the necessary modules for DokuWiki's functionality (e.g., image manipulation, multi-byte string handling, XML parsing, and internationalization).
  
 <code bash> <code bash>
-sudo apt update+sudo apt install -y php8.4 php8.4-fpm php8.4-cli php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip php8.4-intl php8.4-pdo php8.4-mysql 
 + 
 + 
 +</code> 
 + 
 +<WRAP center round info 60%> 
 +**Note:** We include **php-fpm** for use with high-performance web servers like **Nginx** or **Apache** via **mod_fcgid** or **mod_proxy_fcgi**. If you encounter issues, ensure `php8.4` is available in the PPA at the time of installation, as this version may be a development or future release. 
 +</WRAP> 
 + 
 + 
 +===== MariaDB Server Installation ===== 
 +MariaDB is the recommended drop-in replacement for MySQL. 
 + 
 +==== Installation ==== 
 +<code bash> 
 +sudo apt install mariadb-server -y 
 +sudo systemctl start mariadb 
 +sudo systemctl enable mariadb 
 +</code> 
 + 
 +==== Initial Security Setup ==== 
 +Then, secure the installation by running the following script. **Execute all steps carefully.** 
 +<code bash> 
 +sudo mysql_secure_installation 
 +</code> 
 + 
 +* **1- Enter current password for root (enter for none):** 
 +    * **Action:** Press **ENTER** (the root MariaDB user has no password by default after installation). 
 + 
 +* **2- Switch to unix_socket authentication [Y/n]:** 
 +    * **Action:** Type **n**. We will set a password instead. 
 + 
 +* **3- Change the root password? [Y/n]:** 
 +    * **Action:** Type **Y** and set a strong password. 
 +    * RESPONSE: 
 +        - New password: SET A STRONG PASS 
 +        - Re-enter new password: RE-ENTER PASS 
 + 
 +* **4- Remove anonymous users? [Y/n]:** 
 +    * **Action:** Type **Y**. Anonymous users are a security risk. 
 + 
 +* **5- Disallow root login remotely? [Y/n]:** 
 +    * **Action:** Type **Y**. **Highly Recommended** for security unless absolutely required. 
 + 
 +* **6 - Remove test database and access to it? [Y/n]:** 
 +    * **Action:** Type **Y**. 
 + 
 +* **7 - Reload privilege tables now? [Y/n]:** 
 +    * **Action:** Type **Y**. This applies the changes immediately. 
 + 
 +==== MariaDB Service Status ==== 
 +When installed from the default repositories, MariaDB will start running automatically. To test the MariaDB's status, you can run the following command: 
 +<code bash> 
 +sudo systemctl status mariadb 
 +</code> 
 + 
 +You should see a similar output as following one: 
 +<code bash> 
 +● mariadb.service - MariaDB 10.11.13 database server 
 +     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled) 
 +     Active: active (running) since Mon 2025-12-08 09:24:15 CET; 33min ago 
 +       Docs: man:mariadbd(8) 
 +             https://mariadb.com/kb/en/library/systemd/ 
 +   Main PID: 13685 (mariadbd) 
 +     Status: "Taking your SQL requests now..." 
 +      Tasks: 11 (limit: 244840) 
 +     Memory: 78.8M (peak: 85.0M) 
 +        CPU: 640ms 
 +     CGroup: /system.slice/mariadb.service 
 +             └─13685 /usr/sbin/mariadbd 
 +</code> 
 + 
 +==== Testing MariaDB ==== 
 +<code bash> 
 +mysql -u root -pTypeThePasswordThatYouSet 
 +</code> 
 + 
 +If the installation successfully happened, you should see the following message: 
 +<code bash> 
 +user@domain:~$ mysql -u root -pTypeThePasswordThatYouSet 
 +Welcome to the MariaDB monitor.  Commands end with ; or \g. 
 +Your MariaDB connection id is 38 
 +Server version: 10.11.13-MariaDB-0ubuntu0.24.04.1 Ubuntu 24.04 
 + 
 +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 
 + 
 +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
 + 
 +MariaDB [(none)]> 
 +</code> 
 + 
 + 
 +You can just type the following command for exit the MySQL console: 
 +<code mysql> 
 +MariaDB [(none)]> EXIT; 
 +</code> 
 + 
 +If MariaDB is not running, you can start the service by following command: 
 +<code bash> 
 +sudo systemctl start mariadb 
 +</code> 
 +and also enable the service by: 
 +<code bash> 
 +sudo systemctl enable mariadb 
 +</code> 
 + 
 +For and additional check, you can run the following command: 
 +<code bash> 
 +sudo mysqladmin version 
 +</code> 
 +You should receive a response like: 
 +<code bash> 
 +mysqladmin  Ver 10.0 Distrib 10.11.13-MariaDB, for debian-linux-gnu on x86_64 
 +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 
 + 
 +Server version          10.11.13-MariaDB-0ubuntu0.24.04.1 
 +Protocol version        10 
 +Connection              Localhost via UNIX socket 
 +UNIX socket             /run/mysqld/mysqld.sock 
 +Uptime:                 38 min 36 sec 
 + 
 +Threads: 1  Questions: 74  Slow queries: 0  Opens: 33  Open tables: 26  Queries per second avg: 0.031 
 +</code> 
 + 
 +===== Composer Installation ===== 
 +Composer has an awesome description and installation guide on its webpage. You can use the following link: [[https://getcomposer.org/download/]] and see the section that "Command-line installation". I am just referencing the same code here: 
 + 
 +It is better to go your home directory first: 
 +<code bash> 
 +cd ~ 
 +</code> 
 + 
 +== 1. Download the terminal script == 
 +<code bash> 
 +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 
 +</code> 
 + 
 +== 2. Check the hash file == 
 +<code bash> 
 +php -r "if (hash_file('sha384', 'composer-setup.php') === 'c8b085408188070d5f52bcfe4ecfbee5f727afa458b2573b8eaaf77b3419b0bf2768dc67c86944da1544f06fa544fd47') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" 
 +</code> 
 +It should return the following message: **Installer verified** 
 +== 3. Run the Script == 
 +<code bash> 
 +php composer-setup.php 
 +</code> 
 + 
 +It should return the following message: 
 + 
 +<code bash> 
 +All settings correct for using Composer 
 +Downloading... 
 + 
 +Composer (version 2.9.2) successfully installed to: /home/USER/composer.phar 
 +Use it: php composer.phar 
 +</code> 
 + 
 + 
 +== 4. Delete (Unlink) the File == 
 +<code bash> 
 +php -r "unlink('composer-setup.php');" 
 +</code> 
 + 
 +== 5. Add it to the PATH == 
 +Then you can add the composer into your PATH to access the composer with just running `composer` command from any directory: 
 +<code bash> 
 +sudo mv composer.phar /usr/local/bin/composer 
 +</code> 
 + 
 +== 6. Test the Installation == 
 +<code bash> 
 +composer --version
 </code> </code>
  
-==== Installing PHP ====+You need to see something similar like:
 <code bash> <code bash>
-sudo apt install -y php8.4 php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip php8.4-intl+Composer version 2.9.2 2025-11-19 21:57:25 
 +PHP version 8.4.15 (/usr/bin/php8.4) 
 +Run the "diagnose" command to get more detailed diagnostics output.
 </code> </code>
Back to top