WordPress on MAMP giving 'Error 500' with internet connection - wordpress

I have WordPress installed on a MAMP server. After installing some plugins I suddenly got an 'Error 500' but only when my MacBook had wifi connected.
Turning the wifi off fixes the issue, but turning it back on or uploading to a live server causes the issue to return.
After looking through the PHP log, I got:
PHP Parse error: syntax error, unexpected '<', expecting end of file
in /private/var/tmp/theme_temp_setupGlYc25 on line 2
and:
PHP Warning: Use of undefined constant REQUEST_URI - assumed
'REQUEST_URI' (this will throw an Error in a future version of PHP)
in /Applications/MAMP/htdocs/wordpress/wp-
content/themes/THEME_NAME/functions.php on line 48
Uninstalling the plugins that I had recently installed did not fix the issue, nor did re-installing MAMP or moving the installation to a new localhost.

The error is from a WordPress plugin downloaded from an untrusted source.
On installing the plugin, it wrote a number of lines of code in the functions.php file within the theme I was using which was throwing the 'Error 500' as it tried to connect to a server at 'spekt.cc'.
By following the PHP log; googling the Parse error and PHP warning, I saw a post on Medium from someone saying a similar thing happened to them with WordPress attempting to connect to 'spekt.cc'.
Using 'ack' in Homebrew, I searched my WordPress directory and found the affected files. (It had been installed on all themes within the directory)
After removing this PHP code it had inserted and removing the affected plugin, my WordPress is working fine again.

Related

How to fix chmod errors when updating wordpress theme?

I recently upgraded from php 5 to 7.2 and my wp site didnt work, service temporarily unavailable error. So I logged into the backend and WP 5.4 was telling me I needed to check security issues of which I resolved 2 of 3 automatically but 1 could not which is "restrict access to files and folders". So I tried to update the 2017 theme and when I do so I get a bunch of these(although its the same error):
Selected items were updated with errors:
- Unable to update theme 'twentyseventeen_1.7_1_', details: PHP Warning: chmod(): Operation not permitted in /var/www/vhosts/santiapps.com/httpdocs/wordpress_2/wp-admin/includes/class-wp-filesystem-direct.php on line 168
Warning: chmod(): Operation not permitted in /var/www/vhosts/santiapps.com/httpdocs/wordpress_2/wp-admin/includes/class-wp-filesystem-direct.php on line 168
PHP Warning: chmod(): Operation not permitted in /var/www/vhosts/santiapps.com/httpdocs/wordpress_2/wp-admin/includes/class-wp-filesystem-direct.php on line 168
Warning: chmod(): Operation not permitted in /var/www/vhosts/santiapps.com/httpdocs/wordpress_2/wp-admin/includes/class-wp-filesystem-direct.php on line 168...
and near the end it reads:
Warning: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions. "front-page.php, rtl.css, 404.php...
Then in the end it doesnt update of course. A suggestion by the Wordpress Toolkit on plesk is:
Im using filezilla and changing the permissions to those files but I get "operation not permitted".
[SOLVED] (at least for me)
Me too on Cloudways and Digital Ocean.
Just restart the server and error is gone.

Warning: require(/home/domain/public_html/domainname.com/wp-admin/wp-blog-header.php): failed to open stream: No such file or directory

Warning: require(/home/domain/public_html/domainname.com/wp-admin/wp-blog-header.php): failed to open stream: No such file or directory in /home/domain/public_html/domainname.com/wp-admin/index.php on line 17
Fatal error: require(): Failed opening required '/home/domaine/public_html/domainname.com/wp-admin/wp-blog-header.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/domainname.com/wp-admin/index.php on line 17
So I have seen this error before once and it actually occurred on this domain prior to today, but I was able to temporarily resolve this by updating Wordpress 4.9.5 from 4.9.4. This has never happened to me on my host with any other site and I have set up dozens over the years with different Wordpress versions.
However, it just started giving me this error again today only on wp-admin/index.php. If I access any other page, like wp-admin/edit.php?post_type=page, the page loads fine.
I have not made any changes to my site aside from adding content and products between last night and today when the error first came up. Disabling all plugins does not fix the issue. There's no error log yet because the site has no errors, it just won't load /wp-admin.
What is going on? I'm happy to provide the real domain name to those who might have an idea.
I was facing the same issue. wp-blog-header.php does not belong to wp-admin directory. This is a virus. I had to download the whole Website and then cleaned with antivirus.

Suddely files started missing from Wordpress and showing errors

My domain: bharahobe.info
I have installed WordPress in main domain and sydney theme. Everything was okay. Suddenly when I visit my site it shows error messages. Like this:
Warning: require(/home/bharahob/public_html/wp-includes/pomo/mo.php):
failed to open stream: No such file or directory in
/home/bharahob/public_html/wp-settings.php on line 102
Fatal error: require(): Failed opening required
'/home/bharahob/public_html/wp-includes/pomo/mo.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php') in
/home/bharahob/public_html/wp-settings.php on line 102
What should I do now?
If you have access through FTP or SSH, you should log into the server and verify that those files exist. The files may have been deleted by a bot or botched upgrade. The permissions may have changed as well.
If the files are actually missing, you can probably get away with downloading the version of WP you're currently running and replace the missing files.

Fatal error: Class 'WP_Scripts' not found in wp-includes\functions.wp-scripts.php

I have to developed the new wordpress site in my localhost xammp server.
the following fatal error is shown to me Fatal error: Class 'WP_Scripts' not found in wp-includes\functions.wp-scripts.php on line 23.
how to solve this issue, pls anyone help for me.
You have to re-install wordpress again, as somefiles are missing thats why it showing this error.
Do below steps:
Copy your downloaded wordpress repository and paste it again in xamp
server
setup wordpress again
conect with db by adding db configuration
then your issue get resolved
Put this file in wp-includes folder
class.wp-scripts.php
Note: you can find this file from any new wp-setup.

Nginx PHP (5.5.1) FPM strange errors

At the moment I'm experimenting with Nginx.
I got it working using the newest version installed via repo.
Everything works fine with Nginx standalone.
Then I installed PHP 5.5.1 via sources that I can run different versions and not affection the production webserver and php version. (Nginx was running on another port then 80 for testing purposes.)
Everything went fine. Compiled PHP 5.5.1 without errors, installed it, started PHP-FPM and changed the Nginx config to call PHP FPM when needed. My first test website worked perfectly with this version. Then I tried to get running another website I created. I've changed only the document root for that.
Then I got very strange errors:
PHP Fatal error: Call to undefined function apache_request_headers() in [...]
Yes, not real an error... So I removed the function to test if the website works then smoothly when removing a function, which isn't available in PHP-FPM/FastCGI Mode.
Then another error showed in the logs when trying again:
PHP Parse error: syntax error, unexpected ''INSERT ' (T_ENCAPSED_AND_WHITESPACE) in [...]
After commenting out this variable (only for testing) another error occured:
PHP Parse error: syntax error, unexpected end of file, expecting ')' in [...]
So I don't know why those 2 errors occured. The first one is of course of the changed system; function not available.
So my main question is: Why is my code causing these errors with PHP 5.5.1 in FPM mode?
The website works perfectly on my local dev server (PHP 5.4 and Apache) and production Server (Apache 2.2 and PHP 5.4)... I have NO code changed (except config files for db etc). So is someone knowing what can cause this issue?
If you need more information, just ask!
Edit:
Error 1:
$sql = 'INSERT INTO ' . TABLE . '
(name)
VALUES
("' . $name . '")
ON DUPLICATE KEY UPDATE name=VALUES(name)';
Error 2:
'TEXT' => text::parse($row['text']),
Problem solved.
PHP rebuilt via source and used newest version (5.5.2).

Resources