|
| 1 | +# AlmaLinux 10 Frequently asked questions |
| 2 | + |
| 3 | +Quick answers to common questions about switching PHP/Node.js versions, fixing permissions, finding logs, and maintaining your development environment. |
| 4 | + |
| 5 | +## How do I switch to a different version of PHP? |
| 6 | + |
| 7 | +Execute the following command: |
| 8 | + |
| 9 | +```shell |
| 10 | +sudo dnf module switch-to php:remi-{major}.{minor} -y |
| 11 | +``` |
| 12 | + |
| 13 | +where `{major}.{minor}` is one of the supported PHP versions: `8.5`, `8.4`, `8.3`, `8.2` and `8.1`. |
| 14 | + |
| 15 | +Additionally, our setup includes predefined aliases for executing the above command. |
| 16 | +The aliases are the following: |
| 17 | + |
| 18 | +* `php81`: switch to PHP 8.1 |
| 19 | +* `php82`: switch to PHP 8.2 |
| 20 | +* `php83`: switch to PHP 8.3 |
| 21 | +* `php84`: switch to PHP 8.4 |
| 22 | +* `php85`: switch to PHP 8.5 |
| 23 | + |
| 24 | +After switching to a different PHP version, test with the following command: |
| 25 | + |
| 26 | +```shell |
| 27 | +php -v |
| 28 | +``` |
| 29 | + |
| 30 | +Depending on the selected PHP version, the output should look similar to the below: |
| 31 | + |
| 32 | +```terminaloutput |
| 33 | +PHP 8.4.8 (cli) (built: Jun 3 2025 16:29:26) (NTS gcc x86_64) |
| 34 | +Copyright (c) The PHP Group |
| 35 | +Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine |
| 36 | +Zend Engine v4.4.8, Copyright (c) Zend Technologies |
| 37 | +``` |
| 38 | + |
| 39 | +## How do I switch to a different version of Node.js? |
| 40 | + |
| 41 | +Execute the following commands: |
| 42 | + |
| 43 | +```shell |
| 44 | +sudo dnf remove nodejs -y |
| 45 | +curl -fsSL https://rpm.nodesource.com/setup_{major}.x | sudo bash - |
| 46 | +sudo dnf install nodejs -y |
| 47 | +``` |
| 48 | + |
| 49 | +where `{major}` is the Node.js version you want to switch to. |
| 50 | + |
| 51 | +Additionally, our setup includes predefined aliases for the above commands. |
| 52 | +The aliases are the following: |
| 53 | + |
| 54 | +* `node24`: switch to Node.js 24 |
| 55 | +* `node22`: switch to Node.js 22 |
| 56 | +* `node20`: switch to Node.js 20 |
| 57 | +* `node18`: switch to Node.js 18 |
| 58 | + |
| 59 | +After switching to a different Node.js version, test with the following command: |
| 60 | + |
| 61 | +```shell |
| 62 | +node -v |
| 63 | +``` |
| 64 | + |
| 65 | +Depending on the selected Node.js version, the output should look similar to the below: |
| 66 | + |
| 67 | +```terminaloutput |
| 68 | +v24.13.0 |
| 69 | +``` |
| 70 | + |
| 71 | +Check npm version: |
| 72 | + |
| 73 | +```shell |
| 74 | +npm -v |
| 75 | +``` |
| 76 | + |
| 77 | +Depending on the current npm version, the output should look similar to the below: |
| 78 | + |
| 79 | +```terminaloutput |
| 80 | +11.9.0 |
| 81 | +``` |
| 82 | + |
| 83 | +## How do I fix common permission issues? |
| 84 | + |
| 85 | +If running your project, you encounter permission issues, follow the below steps. |
| 86 | + |
| 87 | +`chmod -R 777` grants read/write/execute access to everyone, which is only appropriate for a local development environment like this one. |
| 88 | +Avoid carrying this habit into staging or production, where permissions should be scoped more narrowly (for example, to the web server's user/group). |
| 89 | + |
| 90 | +### Error |
| 91 | + |
| 92 | +PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/data" is not writable... |
| 93 | + |
| 94 | +PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/data/cache" is not writable... |
| 95 | + |
| 96 | +PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/data/cache/doctrine" is not writable... |
| 97 | + |
| 98 | +### Solution |
| 99 | + |
| 100 | +```shell |
| 101 | +chmod -R 777 data |
| 102 | +``` |
| 103 | + |
| 104 | +### Error |
| 105 | + |
| 106 | +PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/public/uploads" is not writable... |
| 107 | + |
| 108 | +### Solution |
| 109 | + |
| 110 | +```shell |
| 111 | +chmod -R 777 public/uploads |
| 112 | +``` |
| 113 | + |
| 114 | +### Error |
| 115 | + |
| 116 | +PHP Fatal error: Uncaught ErrorException: fopen(`<path-to-project>`/log/error-log-yyyy-mm-dd.log): Failed to open stream: Permission denied... |
| 117 | + |
| 118 | +### Solution |
| 119 | + |
| 120 | +```shell |
| 121 | +chmod -R 777 log |
| 122 | +``` |
| 123 | + |
| 124 | +## Where are the error log files? |
| 125 | + |
| 126 | +From time to time, you are encountering various errors which are not displayed. Or you can get errors 500 in a browser. |
| 127 | + |
| 128 | +To find the error messages, you need to read the error log files. |
| 129 | + |
| 130 | +### Apache log files |
| 131 | + |
| 132 | +```text |
| 133 | +/var/log/httpd/error_log |
| 134 | +``` |
| 135 | + |
| 136 | +### PHP-FPM log files |
| 137 | + |
| 138 | +```text |
| 139 | +/var/log/php-fpm/error.log |
| 140 | +/var/log/php-fpm/www-error.log |
| 141 | +``` |
| 142 | + |
| 143 | +## How do I update Composer? |
| 144 | + |
| 145 | +Before updating, check your current Composer version by executing: |
| 146 | + |
| 147 | +```shell |
| 148 | +composer --version |
| 149 | +``` |
| 150 | + |
| 151 | +The output should be similar to: |
| 152 | + |
| 153 | +```text |
| 154 | +Composer version 2.8.5 2025-01-21 15:23:40 |
| 155 | +PHP version 8.3.20 (/usr/bin/php) |
| 156 | +Run the "diagnose" command to get more detailed diagnostics output. |
| 157 | +``` |
| 158 | + |
| 159 | +Update Composer using its own `self-update` command: |
| 160 | + |
| 161 | +```shell |
| 162 | +sudo /usr/local/bin/composer self-update |
| 163 | +``` |
| 164 | + |
| 165 | +The output should be similar to: |
| 166 | + |
| 167 | +```text |
| 168 | +Upgrading to version 2.9.0 (stable channel). |
| 169 | +
|
| 170 | +Use composer self-update --rollback to return to version 2.8.5 |
| 171 | +``` |
| 172 | + |
| 173 | +After updating, check again your Composer version by executing: |
| 174 | + |
| 175 | +```shell |
| 176 | +composer --version |
| 177 | +``` |
| 178 | + |
| 179 | +The output should be similar to: |
| 180 | + |
| 181 | +```text |
| 182 | +Composer version 2.9.0 2025-11-13 10:37:16 |
| 183 | +PHP version 8.5.0 (/usr/bin/php) |
| 184 | +Run the "diagnose" command to get more detailed diagnostics output. |
| 185 | +``` |
| 186 | + |
| 187 | +## How do I update phpMyAdmin? |
| 188 | + |
| 189 | +Being installed as a system package, it can be updated using the command which updates the rest of the system packages: |
| 190 | + |
| 191 | +```shell |
| 192 | +sudo dnf upgrade -y |
| 193 | +``` |
| 194 | + |
| 195 | +## How do I upgrade MariaDB? |
| 196 | + |
| 197 | +Initially, MariaDB was at version 11.4 LTS. |
| 198 | +In case you want to upgrade to a different version, for instance [11.8 LTS](https://mariadb.org/11-8-is-lts/), use the below steps: |
| 199 | + |
| 200 | +* Open the MariaDB.repo file in any text editor. |
| 201 | + |
| 202 | +```shell |
| 203 | +sudo nano /etc/yum.repos.d/MariaDB.repo |
| 204 | +``` |
| 205 | + |
| 206 | +* Modify the **baseurl** variable to match the desired version, for instance `11.8` instead of `11.4`. |
| 207 | +* Clean dnf cache |
| 208 | + |
| 209 | +```shell |
| 210 | +sudo dnf clean all |
| 211 | +``` |
| 212 | + |
| 213 | +* Stop MariaDB |
| 214 | + |
| 215 | +```shell |
| 216 | +sudo systemctl stop mariadb |
| 217 | +``` |
| 218 | + |
| 219 | +* Upgrade MariaDB |
| 220 | + |
| 221 | +```shell |
| 222 | +sudo dnf update -y |
| 223 | +``` |
| 224 | + |
| 225 | +* Start MariaDB |
| 226 | + |
| 227 | +```shell |
| 228 | +sudo systemctl start mariadb |
| 229 | +``` |
| 230 | + |
| 231 | +* Upgrade databases |
| 232 | + |
| 233 | +```shell |
| 234 | +sudo mariadb-upgrade -uroot -p |
| 235 | +``` |
| 236 | + |
| 237 | +* Restart MariaDB |
| 238 | + |
| 239 | +```shell |
| 240 | +sudo systemctl restart mariadb |
| 241 | +``` |
| 242 | + |
| 243 | +## How do I delete a virtualhost? |
| 244 | + |
| 245 | +If for whatever reason you want to delete a virtualhost, for instance `to-be-deleted.localhost` you need to do the following: |
| 246 | + |
| 247 | +* Delete the folder where the files are located |
| 248 | + |
| 249 | +```shell |
| 250 | +sudo rm -rf /var/www/to-be-deleted.localhost |
| 251 | +``` |
| 252 | + |
| 253 | +* Delete the Apache configuration file |
| 254 | + |
| 255 | +```shell |
| 256 | +sudo rm -f /etc/httpd/sites-available/to-be-deleted.localhost.conf |
| 257 | +``` |
| 258 | + |
| 259 | +* Delete the enabled site symlink |
| 260 | + |
| 261 | +```shell |
| 262 | +sudo rm -f /etc/httpd/sites-enabled/to-be-deleted.localhost.conf |
| 263 | +``` |
| 264 | + |
| 265 | +* Restart httpd server |
| 266 | + |
| 267 | +```shell |
| 268 | +sudo systemctl restart httpd |
| 269 | +``` |
| 270 | + |
| 271 | +## How do I create command aliases? |
| 272 | + |
| 273 | +From either your terminal or file explorer, navigate to your home directory (`/home/<your-username>/`). |
| 274 | + |
| 275 | +Using your preferred text editor, open the file: `.bash_profile` (if it does not exist, create it first). |
| 276 | + |
| 277 | +Move to the end of the file and enter on a new line: |
| 278 | + |
| 279 | +```text |
| 280 | +alias command_alias="command to execute" |
| 281 | +``` |
| 282 | + |
| 283 | +where: |
| 284 | + |
| 285 | +* `command_alias` is the name by which you want to call your original command |
| 286 | +* `command to execute`: the original command to be executed on alias call |
| 287 | + |
| 288 | +### Example |
| 289 | + |
| 290 | +```text |
| 291 | +alias list_files="ls -Al" |
| 292 | +``` |
| 293 | + |
| 294 | +will create an alias called `list_files` that will run the command `ls -Al`. |
| 295 | + |
| 296 | +Then, you can execute your custom alias in a terminal just as a regular command: |
| 297 | + |
| 298 | +```shell |
| 299 | +list_files |
| 300 | +``` |
0 commit comments