PHP
-
Installation
-
Reference
PHP - Troubleshooting
Use phpinfo()
to check PHP configuration
-
Create a file
phpinfo.php
in the root directory of the website<?php phpinfo(); ?>
-
Access the file in browser
http://$CONTEXT_PATH/phpinfo.php
Cheatsheet - CLI
List loaded PHP
modules
php -m
Display PHP
configuration
php -i[nfo]
Display PHP config file names
php --ini
Run PHP
script
php -f $script
PHP FPM
Cheatsheet - PHP FPM
List PHP-FPM
pools
ls /etc/php-fpm.d/
Show PHP-FPM error log
tail -f /var/log/php-fpm/error.log
NGINX Website permission settings
Wordpress
-
Reference
Wordpress - wp-config.php
Wordpress - Troubleshotting
-
Info
- WP Admin -> Tools -> Site Health - Info (opens in a new tab)
-
Reference
WP-CLI
Cheatsheet - WP-CLI
- Must be run in the root directory of the WordPress installation, with
wp-config.php
configured.
Show WP-CLI info
wp cli info
List installed plugins
wp plugin list
List installed themes
wp theme list
Update site URL
wp search-replace 'http://example.dev' 'http://example.com' --dry-run
Regenerates thumbnails for one or more attachments
wp media regenerate
Takeaway
Caveats for updating site URL
-
Update values in
wp_options
tableUPDATE wp_options SET option_value = replace(option_value, 'http://example.dev', 'http://example.com') WHERE option_name = 'home' OR option_name = 'siteurl';
-
Search occurrences in text files, including but not exclusive
- Assets URL hardcoded in
CSS
files, such asbackground-image
URL.
- Assets URL hardcoded in
-
Search occurrences in database
Find other options hardcoding the URL
SELECT * FROM wp_options WHERE option_value LIKE '%keyword%'
WooCommerce
WooCommerce - REST API
-
Prerequisites
- Go to Admin → Settings → Permalinks, change Permalink structure to
Post name
. - Go to Admin → WooCommerce → Settings → Advanced → REST API, create a API key.
- Go to Admin → Settings → Permalinks, change Permalink structure to
-
Resources
WooCommerce - Logging
- WP Admin -> WooCommerce -> Status -> Logs
Composer
-
Installation
- On Fedora / RHEL, use REMI repository, beware of PHP version, use DNF module to switch to ensure consistency.
Cheatsheet - Composer
List installed packages
composer show
Show environment
composer diagnose
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.wpackagist-plugin/wpforms-lite : exact version constraints (1.8.5.2) should be avoided if the package follows semantic versioning
Checking platform settings: OK
Checking git settings: OK git version 2.39.3
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Composer version: 2.6.5
PHP version: 8.2 - Package overridden via config.platform, actual: 8.2.13
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 1.1.1k FIPS 25 Mar 2021
cURL version: 7.61.1 libz 1.2.11 ssl OpenSSL/1.1.1k
zip: extension present, unzip present, 7-Zip not available
Search for packages
composer search $package
Install a single package without updating other dependencies
This is the recommended way to update dependencies in production, so no implicit update will be triggered.
composer require $package --no-update
composer update $package
# composer require wpackagist-plugin/avif-support --no-update
# Updating composer.json
Using version ^1.0 for wpackagist-plugin/avif-support
./composer.json has been updated
# composer update wpackagist-plugin/avif-support
# Updating composer.lock
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking wpackagist-plugin/avif-support (1.0.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.