I encountered the dreaded wordpress 500 error but couldn't find a solution from other topics. Here is my situation:
My site works fine locally, with the url localhost/zufic. It worked fine on my staging test.zufic.com as of this morning.
I flushed my permalinks (on local) to fix some inconcistencies in page URLs, which worked
After uploading the new database to my staging site (changing my URLs from local to remote, as usual), the CSS on my homepage is a mess, and all subpages give me 500 errors.
Screenshots of the homepage between local & remote
I tried the following, to no avail:
disabling all plugins
flushing permalinks on the remote website
checking my DB for a bad search/replace in my URLs, but all is fine
reinstalling the core wordpress files
deleting all remote FTP files and replacing them with the local WP folder
uploading a backup of my remote DB
Updating my PHP version
I also tried displaying error logs through wp-config but couldn't get them to show up for some reason.
I certainly messed up something, but what? Any tip for how to proceed and save my sanity?
UPDATE:
So I checked the logs, where this error shows up repeatedly:
AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://test.zufic.com/
From what I understood, it comes from a faulty .htaccess? I reset it on the remote site (renamed the existing file, flushed the permalinks to generate a new htaccess) > I can see my subpages now, but the CSS is still messed up.
Here is my remote htaccess (=default WP file):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Here is the error I see in WP_debug:
[16-Sep-2021 14:56:00 UTC] PHP Warning: require_once(/home/zuficcomap/test/wp-includes/sodium_compat/src/Compat.php): failed to open stream: No such file or directory in /home/zuficcomap/test/wp-includes/sodium_compat/autoload.php on line 45
[16-Sep-2021 14:56:00 UTC] PHP Fatal error: require_once(): Failed opening required '/home/zuficcomap/test/wp-includes/sodium_compat/src/Compat.php' (include_path='.:/usr/local/php7.0/lib/php') in /home/zuficcomap/test/wp-includes/sodium_compat/autoload.php on line 45
[17-Sep-2021 09:15:22 UTC] PHP Notice: Array to string conversion in /home/zuficcomap/test/wp-includes/formatting.php on line 1098
The Compat.php file IS present at the specified location so I'm not sure why it can't be found?
Related
Working on a site with php 7.2, Symfony 4 and Sonata admin 3.
In dev, on my machine, everything works fine, the site itself, and the two admins (user and content).
I have put everything on the final server (unfortunately, file by file, no console with S4 ! so, no "composer:install"...).
Still on dev, the site works fine, all functionalities.
But when I try to use the admin page, I only get a non-formatted page. None of the assets (css and js) seems to work!
However the source code are identical, on localhost and the distant site...
Can anyone help me
Edit : I found where the issue comes from : it's linked to .htaccess.
The http address I use ends in /public/index.php. I use .htaccess to shorten it and when using the .htacces redirection I can't get the assets of the admin page, while it works fine without redirection.
Is there something I should change in my .htaccess code ?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/index.php
</IfModule>
I'm trying to install LetsEncrypt with cakephp and I'm having some issues.Let me describe:
First I'm installing LetsEncrypt on a server with CentOS 6.
As mentioned on several websites it needs a python upgrade from 2.6 to 2.7 as LetsEncrypt needs Python 2.7. Which I did.
Then if I run ./letsencrypt-auto I get
"No installers are available on your OS yet; try running "letsencrypt-auto certonly" to get a cert you can install manually"
I understand that this is normal as there is no installer for CentOS 6.
So I run ./letsencrypt-auto certonly.A window appears.I have the choice between:
Place files in webroot directory
Automatically use a temporary webserver
So I press 1.Then I enter my domain name.And I see:
Enter a new webroot
I press ok and I see my root directory.I select /root
And then I have the following error:
Failed authorization procedure. www.example.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient
authorization :: Invalid response from
http://www.example.com/.well-known/acme-challenge/-CnpDIgxBB9EOH-BCssGOyiunFjnMlGLWhWw9roE4Ds:
"
500 Internal Server Error Inter"
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: www.example.com Type: unauthorized Detail: Invalid
response from http://www.example.com/.well-known
/acme-challenge/-CnpDIgxBB9EOH-BCssGOyiunFjnMlGLWhWw9roE4Ds:
"
500 Internal Server Error
Inter"
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A record(s) for that domain
contain(s) the right IP address.
And here comes cakephp. As mentioned I'm using cakephp. And it seems that for this specific issue you need to modify htaccess files as mentioned here
I need to add "RewriteRule ^(\.well-known/.*)$ $1 [L]" as the first rewrite rule in the root htaccess and the app/.htaccess
Which I did.
root .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(\.well-known/.*)$ $1 [L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
AddDefaultCharset UTF-8
</IfModule>
app/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(\.well-known/.*)$ $1 [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
AddDefaultCharset UTF-8
</IfModule>
But I still have the same problem
Any idea what I did wrong?
Thanks a lot
Cake's webroot has an .htaccess with a RewriteCond %{REQUEST_FILENAME} !-d rule that means cake will not be called in for any request that matches an actual directory inside webroot.
So just place the .well-known directory and everything else that is needed inside the webroot directory, you should be able to access them fine without messing up with .htaccess.
PS. In some cases the file Let's encrypt requires is not served back as text, in which case you should enable the headers apache module (if not enabled already) and put the following rule in your apache or virtualhost config:
<IfModule mod_headers.c>
<LocationMatch "/.well-known/acme-challenge/*">
Header set Content-Type "text/plain"
</LocationMatch>
</IfModule>
I have just installed ImpressPages 4_0_17 and I completed the installation process through the point of filling out the database form and submitting it. The next page gave a 404 error on the URL /ImpressPages/admin. Prior to that, the systems check page listed 3 warnings: Magic quotes Off, Apache mod_rewrite, PHP memory limit 64MB. No other info on these warnings was available on that page.
I am using the alias feature on GoDaddy for hosting, which allows me to create multiple websites in the same account. In addition, I am using a sub-domain for this install so I can test it out before replacing the original site. Because I uploaded the entire IP zip file and extracted it in the web root folder, all the IP files are now installed in the folder /ImpressPages.
After the 404 error, I altered the URL to be just /ImpressPages/. That actually loaded fine. In addition, a small dialog popped up saying that I had been automatically logged in as admin. It gave me the username, password and the email I configured for the site. It also provided the admin page URL that produces a 404 error and said I needed to go there to login in the future.
The home page at /ImpressPages/ loads and shows inline editing features. If I click the Lorem Ipsum link, /ImpressPages/index.php/lorem-ipsumy, I get a white page with the one line:
"No input file specified."
I have tried a few tweaks to the .htaccess file with no success. The latest active lines are shown below. All the other lines from the default file are commented out and I have not tried messing with them.
<IfModule mod_rewrite.c>
RewriteEngine on
# Attempt to fix SVG images, 6/4/2014
AddType image/svg+xml svg
AddType image/svg+xml svgz
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ImpressPages/index.php?%{QUERY_STRING} [L]
# Redirect www urls to non-www.
# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
The changes I attempted to get admin access are in the RewriteRule. I prefixed index.php first with a slash, then with /ImpressPages/. Neither one helped. Any suggestions on how to get admin access will be greatly appreciated.
17:11 - New info:
With the /ImpressPages/ path and the following .htaccess lines enabled, I can now get the login dialog on the admin page. Once I enter the login correctly, the next URL is /ImpressPages/index.php with the white page described previously. Then reloading /ImpressPages/admin produces the same white page and the same /ImpressPages/index.php URL. So now I can login, but it doesn't help.
Options -Indexes
Options -MultiViews
Those lines are in the default .htaccess file already. I just removed the comment character to activate them.
17:45 - more progress.
I moved all the contents of the /ImpressPages/ folder up one level to web root. Then I removed /ImpressPages/ from the path for index.php in the rewrite rule. With that one change, admin login started working and I am now able to edit my site. There are still issues. For example, publishing a page does publish the changes, but then loads the typical white page with the URL /index.php/home. The URL / loads the home page correctly. Almost sounds like the URL routing is not working correctly.
It looks like ImpressPages instal decided your server doesn't support URL rewrites and has placed rewritesDisabled in config.php
Try to remove this config line.
I have a demand where I need to deny access to a folder (localhost\uploads\video). I got this by applying the below rule in the htacess at localhost:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(|avi|mp4)$ - [F,NC]
Scenario 1 - It works fine if I try to access the resoruce (.avi files mainly)by typing the address straighforward in the browser and this is the message:
Forbidden You don't have permission to access /video/23/videoname.html on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.THIS IS OK.
Scenario 2 - With tis rule applied, if I try to click in any link in my homepage which leads me to the video I'm also getting the same message than in scenario 1 and this isn't what I wanted to. I thought when I would access through homepage(by clicking over the avi link) this message wouldn't come.
How can I get this done in this way? I want to block over direct access but I want to keep it working fine if this be executed from homepage...
Regards
Eliel
Your regex seems to be problem for URI pattern matching. Change you rule to:
RewriteCond %{HTTP_REFERER} !(www\.)?domain\. [NC]
RewriteRule \.(avi|mp4)$ - [F,NC]
Make sure to replace domain with your actual domain name.
I seriously can't understand what is going on here. I just uploaded my web app from localhost to new domain-name on Windows IIS Server. When I try to access the web app, CSS files and images are not loaded and I get the following error:
"CssController could not be found."
I don't understand why it is doing this.
Although I've written code like this in my default.ctp:
echo $this->html->css('generic');
CSS files are placed in:
app\webroot\css
I have searched on Google and have tried everything, I even uncommented the line:
Configure::write('App.baseUrl',env('SCRIPT_NAME')); in core.php
But I still cannot get this to work. Please help me to resolve this issue.
Double check that you have all the .htaccess files in place.
Also making sure /app/webroot/ has its .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
Your request is trying to get the css file from /css/ but i'm thinking you don't have the proper .htaccess files in place to route it to the webroot and not to a controller!
also check if mod_rewrite is enabled
Edit: and then I saw the IIS part, you need some IIS equivalent to mod_rewrite
In this article you find all the information required for successfully run CakePHP web applications under Microsoft IIS web server: http://bakery.cakephp.org/articles/filippo.toso/2008/01/29/cakephp-on-iis
Here is a related question about getting cake to work on IIS: CakePHP 2.2.2 not working on Windows IIS7