
This guide focuses specifically on the parts of WP-CLI that trip people up on shared DirectAdmin hosting, which differs from running it on a VPS with full root access — from requesting SSH access, to common permission errors, to scheduling WP-CLI via cron. (For a full command reference covering every category, see our complete WP-CLI guide.)
What Is WP-CLI?
WP-CLI (WordPress Command Line Interface) is the official command-line tool for managing WordPress, replacing clicking through the dashboard. It covers everything from installation and updates to plugin/theme management and database operations — ideal for repetitive tasks or managing several sites at once, and much faster than navigating menus one at a time.
Why Shared Hosting Is Different from a VPS
On a VPS, you have full root access, so you can install WP-CLI globally and run commands with no restrictions. On shared hosting like DirectAdmin, however, users are limited to their own account's home directory, which brings extra considerations: WP-CLI must be installed in a personal folder rather than system-wide, some hosts disable certain PHP functions via disable_functions that WP-CLI may rely on, and the PHP CLI memory limit is often separate from the web memory limit configured in DirectAdmin.
Requesting SSH Access on DirectAdmin Hosting
Most shared hosting disables SSH access by default for security reasons — you'll need to request it before you can use WP-CLI:
- Contact your hosting provider's support team and request SSH access for your account.
- Once enabled, you'll receive a hostname, port (often not the standard port 22 on some shared hosting, for security), and a username plus password or SSH key.
- Connect with
ssh [email protected] -p PORTfrom a terminal, or use PuTTY on Windows. - Verify the connection succeeded by running
pwd— you should see your account's home directory path.
AsiaGB Hosting lets customers request SSH access through the ticket system, with the team reviewing and enabling it during business hours.
Installing WP-CLI Without Root Access
Since you don't have sudo mv privileges to place files in /usr/local/bin as you would on a VPS, install WP-CLI in your personal folder instead:
- Create a folder for binaries, e.g.
mkdir -p ~/bin. - Download the file with
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar. - Make it executable with
chmod +x wp-cli.phar, then move it into your personal folder:mv wp-cli.phar ~/bin/wp. - Add your personal folder to the shell's PATH by adding
export PATH="$HOME/bin:$PATH"to~/.bashrcor~/.bash_profile. - Run
source ~/.bashrc, then test withwp --version.
Some hosts already have WP-CLI installed system-wide — always try wp --version first before installing, and skip the setup entirely if it's already there.
Fixing Common Permission Errors
- Error: This does not seem to be a WordPress installation — you must run the command from inside the folder containing that site's wp-config.php file. Always
cd public_htmlfirst. - Error: Could not create directory — usually a write-permission issue. Check that the SSH-logged-in user matches the file owner; if not, ask support to correct permissions.
- PHP Fatal error: Allowed memory size exhausted — the PHP CLI memory limit is separate from the web memory limit. Fix it with
php -d memory_limit=512M $(which wp) core updateto temporarily raise memory for that one command. - Error: exec() has been disabled — some shared hosts disable the exec() function for security, which breaks WP-CLI commands that call external programs. Contact support to check whether it can be enabled for your account specifically.
Most Useful Commands for Day-to-Day Hosting Tasks
For everyday work on shared hosting, only a handful of commands come up repeatedly:
wp core updateandwp plugin update --all— update WordPress core and every plugin in a single command, far faster than clicking through the dashboard one at a time.wp search-replace 'old-url.com' 'new-url.com' --dry-run— test a URL replacement before running it for real when migrating a domain or hosting provider.wp db export backup-$(date +%F).sql— quickly back up the database before a major update (see the full WP-CLI guide for more database commands).wp plugin list --status=inactive— check for inactive plugins still sitting around; these should be deleted to reduce security risk.
Scheduling WP-CLI Automatically via Cron on DirectAdmin
Once you have SSH access, you can create a cron job through the Cron Jobs menu in DirectAdmin to run WP-CLI commands on a schedule — for example, updating plugins every week:
0 3 * * 1 cd /home/username/domains/yourdomain.com/public_html && /home/username/bin/wp plugin update --all --quiet
Always use the full path for both the website folder and the wp binary, since cron doesn't know the PATH configured in .bashrc the way an interactive SSH session does.
Tip: before running any command that changes data — like search-replace or core update — always back up your database first, with JetBackup or DirectAdmin's standard backup. As fast and convenient as WP-CLI is, it applies changes immediately with no confirmation step like the dashboard has.
Does every shared host support WP-CLI?
Not every host does — it depends on whether the provider grants SSH access. AsiaGB Hosting lets customers request SSH access through the ticket system, while some other hosts don't offer it at all for security reasons. Check with your provider first.
Can I use WP-CLI without SSH access?
No, not directly — WP-CLI can only run from a terminal. Without SSH access, you'll need to manage your site through the dashboard as usual, or ask your hosting provider to enable SSH first.
Why do I get Permission Denied when running a wp command?
This usually happens because the SSH-logged-in user doesn't match the file owner, or the installed wp file lacks execute permission. Check with ls -la and run chmod +x to grant execute permission if needed.
What's the difference between wp-cli.phar and wp?
They're the same file — wp-cli.phar is the name of the downloaded file, and wp is the shorter name you give it after moving it into your PATH folder. There's no functional difference between the two.
My WP-CLI cron job isn't running — what should I check first?
Make sure you're using the full path to the wp binary and the website folder in your cron command instead of relying on PATH, since cron doesn't load values from .bashrc the way an interactive SSH session does.
Is WP-CLI safe enough to use on a production site?
Yes, it's the official tool from the WordPress team itself. However, since commands take effect immediately with no confirmation step like the dashboard, always back up your database before running anything that changes data, especially search-replace and core update.
Hosting Ready to Enable SSH for WP-CLI
AsiaGB DirectAdmin Hosting grants SSH access through the ticket system, supporting WP-CLI, Composer, and Git deploy for developers.
View Hosting Plans