PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, March 13, 2022

[FIXED] Error when running WordPress on new server

 March 13, 2022     cakephp, php, wordpress     No comments   

Issue

I've just upload a WordPress project into a web server. Everything went fine with the exception of the User-Photo plugin. The problem I'm having is that its doesn't seems to find the basedir path. This is the error:

Upload error: Unable to place the user photo at: /var/www/clients/client2/web4/web/arsoblog/wp-content/uploads/userphoto/1.jpg

First of all, I don't know where this path is. Even on the local server, where the site is working good, is using the exact same path, which I can't find.

Maybe someone of you knows what could have changed from one server to the other. By the way, the blog is inside another site in the web server, which is developed using CakePHP.

EDIT --- I'm having the same problem with all the uploads!


Solution

The problem is in your upload directory. When we develop the WordPress site in localhost, the default upload directory will be point to your localhost only. When you move to online server, this directory path will not change.

To override this do the following steps:

  1. Login to your cPanel/control Panel
  2. Go to phpMyadmin
  3. Select your database.
  4. Go to wp_options table
  5. On the second page (around 58th row) Edit 'upload_path'(For the first time this row may be blank).
  6. Give your correct directory.Eg: /home/username/public_html/folder-name/wp-content/uploads

Change "username" and "folder-name". Username is usually the username you use to login to cPanel, or your domain’s control panel. Folder-name is used for the sites hosted in subfolders. If you hosted the site in root folder, remove it.

Here is a detailed tutorial How to move wordpress to a new server or host.

If you already used WordPress uploader in localhost, you need to do a search in wp_posts table and replace your localhost reference to your live site's reference. There are some plugin available to do these search and replace in database. Check this one

Hope this will solve your problem.



Answered By - Libin
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing