Wordpress White Screen of Death - php

One of my client's site was taken down by hosting as it was sending spam, the site was working fine before it was taken down by hosting, I downloaded the wp-content folder from Cpanel and full dump of database. When I run the site at localhost, it shows the blank page on all directories. When I use the dumped database, it goes blank but when i change it to fresh WP database, the sites looks fine, so it means there is some problem or mis configuration on database? I started debugging manually and found that the file wp-blog-header.php is not getting this file
require_once( ABSPATH . WPINC . '/template-loader.php' );
Because I added echo "Oh God why?"; in template-loader.php and it was not showing the result while with the fresh integrated database, it shows the result.
Can someone please give suggestion that what could be the problem in database?

Your live WP site and your local one will (should) use two separate databases.
In your local phpMyAdmin, make sure you've imported the exported database from the live site.
In your wp-options table, change siteurl to http://localhost/yourpath/toWP.
This should be pointing to your actual
Wordpress folder.
Locate the wp-config.php in your actual WP folder, and make sure the WP_HOME, WP_SITEURL, DB_NAME, DB_USER, DB_PASSWORD, and DP_HOST
All of this has to match up to your local setup, otherwise it will fail (WSOD).
If this doesn't work, it's possible the person that set it up changed some things to make it hard to maintain without him/her. I've seen it done. Personally, I detest WP for things other than blogs. It has a lot of security problems, constantly needs updates, and allows people that really shouldn't be doing web design to toss something together with templates and call it "professional". Good luck!

You are basically changing the domain of your WordPress installation from www.example.com (the original domain) to www.example.local (your localhost).
I usually use this procedure to move WP from a domain to local:
Download from WordPress site the corresponding version of WP and install it on local.
Overwrite the new db with your backup
Change wp-config.php to point to the backup db (only if config changed, i.e. table prefix)
Follow one of the many guides to move WP to a new domain. Example 1, Example 2 and change the db fields to your local domain (www.example.local).
Restart your local apache
It should now be ok to login and regenerate permalinks.

Related

WordPress migration is redirecting me to do a new installation of WordPress site

I thought I followed the steps to migrate my WordPress site over to a new host correctly but when I navigate to the new site I am getting redirected to the WordPress installation page. Here was my process:
ZIP'ed up all of the files of my old WordPress site
Exported the MySQL database
Uploaded and unzipped the files on the new host
Imported the MySQL database on the new host
Changed the database connection information in the wp-config.php
Changed the siteurl and home in the database options table
Obviously I am missing something but it is not jumping out at me as to where or what I have overlooked.
At first glance you have done enough it probably should load. Looks like the wp-config is invalid or missing if it's wanting to do a new installation from scratch. Check file permissions and server logs. Use wp cli to try and verify parts. E.g. wp db cli will try and connnect to the DB, so that should fail if the DB connection isn't right (quite a likely cause) and wp shell will give you a PHP console with WP laoded - I find this often prints out useful debugging info if it fails.
However, am I right in deducing from your "Changed the siteurl and home in the database options table" that you migrated not only to a new host, but a different domain as well? In that case you need to change much more in the DB than just those two settings. WP stores all internal links as absolute URLs for example. I would again use wp-cli. The following command is fairly powerful and wide-ranging, so think through your values, but I use it for this kind of migration:
wp search-replace 'old.domain.name' 'shiny.new.domain.name' --all-tables
If it's a multi-site installation, there's a constant in wp-config.php for the default domain that needs updating too

Issue accessing local hosted Wordpress site (redirects+other nonsense)

I have ran into quite the issue.
I have been developing a website hosted locally with MAMP. I always used localhost:90/wordpress/ to access the website and it was worked up till today. A few hours ago, I began the process of moving the website from local server to an actual domain. Unfortunately, I wasn't checking URLs and ended up changing some information and working on localhost myPHPadmin panel as opposed to the domain myPHPadmin panel. Long story short, I changed so much before I realized my mistake, then proceed to change even more, and now I am lost and don't know what to do. At this point, I am just trying to get access to my local hosted website so I can start over again.
The issue:
Everytime I goto localhost:90/wordpress, Chrome redirects me to localhost/wordpress and my website doesn't show, it says that the website can't be shown.
I have tried going into my local hosted myPHPadmin panel and changing siteurl and home to both say localhost, but no luck. Interestingly, when I change both to wordpress, it shows an unformatted version of my homepage (Kinda like just straight HTML), with limited images, however if I click any links then it brings me to wordpress/about and it doesn't exist. If I change it to just localhost:90, it shows my unformatted wordpress Page not found page. Can't access wp-admin with any of them.
I have tried using a replace tool recommended in another thread, but searching for localhost and replacing with localhost:90 yielded no results for me. I have also double checked the .htaccess folder and it is correct. I have cleared cookies/cache and still nothing. I am desperate.
Any help is much appreciated.
I am not sure what the issue is here so I am going to shoot in the dark here and hopefully one of these methods will get you out of your predicament. Since you say that you have reverted all the changes you made and still your website is inaccessible, even wp-admin.
You can try doing the following:
Change the siteurl and homeurl links in your PHPmyadmin to localhost:90/wordpress or whatever it was before when your site was running and functional.
In your Wordpress root folder, there is a file called wp-config.php. Open that file and find:
* #package WordPress
*/
Add after:
define('WP_HOME','localhost:90/wordpress');
define('WP_SITEURL','localhost:90/wordpress');
You will replace all localhost:90/wordpress if need be by which I have written in my codes to what the link was before; when the site was functional.
Check the file thoroughly and through Find/Replace function of your favourite text editor for no duplicate entries.
Now try accessing wp-admin. If you still cannot access your wp-admin, take a backup of your current wp-admin folder.
From a fresh Wordpress of the same version as yours, copy the wp-admin folder and replace it with your current wp-admin folder. Now try to access wp-admin again.
If you are able to access it and login, refresh your Permalinks. See if your site is accessbile again after doing these steps.
Update:
Since none of those steps worked for you, try doing the following:
Delete all the Wordpress core files from your localhost:90/wordpress EXCEPT wp-config.php and your wp-content folder.
Now from a fresh Wordpress folder, copy the files and folders EXCEPT wp-config.php file and wp-content folder. Paste them in your localhost:90/wordpress folder.
Try accessing your website now.
Update 2:
Try uploading your Wordpress to your online server and change the values of siteurl and homeurl in your wp-config.php file. We defined the localhost addresses in the file, now you will update those with your domain details.
Take a fresh backup of your database from your localhost and import it into a new database in your online server. Update the homeurl and siteurl in your newly imported database.
Update your wp-config.php with the new database name and username and password of the account you have given all privilages to access the database.
Try accessing wp-admin now.
If successful, update your Permalinks and then try accessing your website.
This will tell us if your localhost is faulty.

Wordpress - plugins making HTTP requests to the wrong domain

Back story- I have a site up and running fine with up-to-date wordpress & woocommerce. The owner wanted to re-do all of the products & to get a new domain name; since the old site is working fine & he has customers placing orders daily, I made a copy of the website using godaddy's installatron & assigned it a subdomain name. Everything was working fine, i thought.
While installing new plugins (Woocommerce, WP All Import, etc.) I am noticing that all the plugins' HTTP requests are being made to the old domain name. The old site is still live so many requests actually still make it just fine, but new plugins aren't working because they are trying to get JS files from the old domain (not the new one).
I've tried setting the WP_CONTENT_URL to the current domain explicitly but it doesn't change the request's location.
Any ideas of issues that could have arisen from the site transfer or the hosting? I'm currently running a grep on the WP files for the old domain name but it's gonna take a while.
Before you begin with this, make sure that you have a backup of your database just in case.
If you have access to the SSH of the Wordpress files, you may use WP CLI. Try running the command below to check if there are replacements:
wp search-replace 'old_url' 'new_url' --dryrun
If there are replacements, that means that you can change the old_url to the new url. Just remove --dryrun to proceed with the changes.
Ended up figuring it out-when I said I had set the WP_CONTENT_URL, I was doing so at the end of the wp-config file, after constants had already been defined. Moving it up before the following line fixed everything:
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/')

Change database server is WordPress

I have to update (move) actual database (exported as .sql from phpMyAdmin) to new one (already imported, same as old database). Problem is that, when I update file wp-config.php to new database (I just updated dbname, user, password and server), then it show up installation. When I set it back to old databse, it works OK. So, there is something that I need to update in DB? It seems like there would by any option about installation? Not sure, because new databse is well-filled.
So there is this neat tool I like to use when migrating the entire installation that I've developed locally.
Search Replace DB
Say you've developed everything locally, and even put the content in. Naturally WordPress will populate database with local links - something like
http://localhost/wp-content/uploads....
But when you move this to a new WordPress installation (clean), you cannot just import the exported .sql database, because it contains the old links with your localhost in it.
So that's why you first copy your old installation to the new server, then import the database, and then create a folder called sr where you put in the aforementioned script.
Now it's important not to open the newly copied WordPress installation once you've imported the database, because you'll get mixed links, and it could get messed up here.
Instead go to the /sr folder on your live site
http://www.yoursite.com/sr
And you'll see a search and replace screen.
There, just change
localhost -> www.yoursite.com
or whatever the equivalent to your localhost might be, in my case it's usually IP address of the test server I am developing.
Your database details like name, username and password should be pulled from the wp-config.php file.
Then just click dry run. This will show you all the replaced links in the database. Then you can inspect to ensure that you've correctly replaced the links - you only need to change the 'base' of the link. The path to uploads folder, for instance, should remain the same (remember, you've copied the entire wp-content folder to your live server).
If you think it's ok, do a live run, and let the script replace the links. After it's done delete it from the server - the entire /sr folder. Because if you leave it, someone could mess up your database.
After that, you can log in to your WordPress and all the content should be there exactly as you've left it on your localhost.
Hope this helps :)
You can use wp migrate db plugin to migrate you db for new server , after installation it require new server url and absolute path after that you and get original db to import .

Error when running WordPress on new server

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!
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:
Login to your cPanel/control Panel
Go to phpMyadmin
Select your database.
Go to wp_options table
On the second page (around 58th row) Edit 'upload_path'(For the first time this row may be blank).
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.
777 permissions are dangerous and not the correct fix for the issue. You will get hacked with 777 permissions. See Hardening WordPress « WordPress Codex
For solving this problem you have follow some step,
*Login to your cPanel/control Panel
*Go to phpMyadmin
*Select your database.
*Go to wp_options table
*On the second page (around 58th row) Edit 'upload_path'
*Give your correct directory.Eg: /home/username/public_html/folder-name/wp-content/uploads
then you shift your server See tutorial
for more
http://www.techyv.com/questions/error-when-running-wordpress-new-server

Categories