syntax error, unexpected 'define' (T_STRING) - wordpress

Don't know much coding, getting the captioned error when I try to visit my website / log in. Looking for a solution. Thanks in advance.

You have to open wp-config.php and look at Line 4 because there is a php syntax error in the code in that file. If you want further details on how to fix please post the code from wp-config.php

I had a similar problem. Different line number, but the same basic error message, which prevented the site from loading. There didn't seem to be anything wring with the code in wp-config.
I solved the issue by downloading a fresh copy of WordPress then using FTP to replace everything except the wp-config file and the wp-content folder. Your WordPress content lives in the wp-cntent folder so you don't want to replace that.
As soon as a replaced the other files. I refreshed the browser and the site loaded normally. I'm guessing somehow some crucial file became corrupted and that kept WordPress from loading.
The only WordPress file you should be editing is wp-config. All your other data will be in wp-content or the MySql database. Retain the wp-content folder and the wp-config.php file and replace everything else. It worked for me.

Related

How to create a duplicate WordPress site running on localhost

I am running a local copy of WordPress and simply want to duplicate the whole folder. When I copy all the files into another folder and run it on localhost, i get a 404 error. Also the new folder i've pasted into is 10mb larger. What exactly is happening?
I assume the 404 error is something to do with the database, but I expect everything to be the same. The config file is pointing to correct DB etc. Thanks
You can use wordpress duplicator for copy site correctly. Otherwise, you need manually fix some of the links in the db.
to fix the duplicate wp site not showing on localhost. in wpconfig, i needed to add:
define('WP_HOME','http://localhost/duplicatesite');
define('WP_SITEURL','http://localhost/duplicatesite');
not sure why thats not needed on the original site, or why when copying a folder, it increases the size, but hey. thanks anyway

Not Acceptable?

My site is running but I could not log in to admin dashboard, got this error
Not Acceptable!
An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.
After googling I found out it has to do with mod_security. I tried every approach to fix it: changed my plugin folder name, tried disabling mod_security with .htaccess but the error remains the same.
Are there other alternatives that I could take?
Difficult question! To be honest, I wouldn't try to fix it. I would suggest copying files and database to a local WordPress. If everything is running on you local machine, I would delete the WordPress server version and install a new WordPress and copy the database and all the files.
If you think of the hours, you try to fix it instead of copy the whole WordPress and install a new one.
please delete you .htaccess file from the root directory and try to login into wp-admin. Once login gets successfully then regenerate the .htaccess file.
For regenerate the .htaccess file you need to follow the below steps:
Go to setting -> permalink -> change permalink into default.
And save the setting.
After save setting then change permalink into the post.
Now you can see that the .htaccess file gets generated successfully.

Internal Server Error while opening wordpress site

I was trying to modify functions.php file in wordpress site. I added some lines of code and update the file. Now my site is not opening at shown Internal server error as shown in the image below.
I have also tried to remove new code and trying to update file again, but this error is still there. How to resolve this?
Solution:
Finally I have resolve it. The file I was trying to change functions.php, had some wrong syntax in code. I mistakenly updated the file with some wrong syntax, but I was not able to re-edit that file later on and I was not able to access to my wordpress admin panel too.
I went to my file manager and went to that particular theme and find functions.php file. I then removed that piece of code from it and issue resolved.
One thing you can try, if you have the ability to ftp, rename the htaccess file to something like htaccess_bak, to see if that fixes it. Normally if that file gets corrupted, it will show that message

Wordpress configuration on live server showing error

I have made some configuration in wordpress themes and plugins. It worked fine in localhost. After that I just uploaded the files to wordpress(Plugins and themes). After that in search field when I tried to search something it showed an error like
Warning: include_once(wp-load.php) [function.include-once]: failed to open stream: No such file or directory in /home/foledrname/public_html/clients/london/wp-content/plugins/wp-easybooking/widgets/ajaxProposeLocation.php on line 15.
In localhost all the things are working just perfect. So can someone kindly tell me whats the issue here?
it seems on page ajaxProposeLocation.php where you are loading wp-load.php with include statement its path is wrong
you should not include wp-load.php in wp plugin becoz Both the plugin directory and the wp-content directory can be moved around in the installation. ALL the WordPress files could be moved about in this manner, are you going to search around for them?
You’ve just doubled the load on that server. WordPress and the PHP processing of it all now have to get loaded twice for every page load.
may i ask why you are loading wp-load.php ?

WordPress 404 Errors

I moved a Wordpress website from one server to another and I am now getting 404 errors on everything but the home page.
I also checked that the .htaccess file is there and the database contents. They are fine. Not sure what else could be causing this.
Any ideas from the community?
Assuming you have pretty permalinks enabled, are you sure that the new server has mod-rewrite enabled? You can also check to see if this is the problem by going to a pagelike yoursite.com/?p=1 where 1 is a page id.
Assuming the URL has changed
You need to update either the database or (if you're lucky) one of the .php files in the wordpress distro - see the wordpress article on this.
I had the same issue and ended up having to edit the database. You're seeing the 404's because wordpress thinks it's still hosted at the old URL and is therefore trying to retrieve files from it.
If the URL has not changed
Perhaps permissions need updating on the folders? The folders should be set at 755 and the files 644 (reference here).
Looks like you may have solved the problem - I had a similar problem where permalinks would not work, but the default links did work. I modified the .htaccess file to what Wordpress said to do. Twice I thought I had solved the problem, but didn't.
I had moved it to my local Ubuntu Karmic Koala system for testing, and found that the solution involved editing a file in /etc/apache2/sites-enabled. On my system, it was called 000-default.
This file had statements like the .htaccess file, and in two places had AllowOverride None, which I had to change to AllowOverride All. Apparently, this file overrides any local .htaccess files.
I also had to change the location of Wordpress in the main configuration, but that was obvious.
I hope this will help someone who has tried all the normal suggestions like me, and is still having problems.

Resources