Fix mixed content in PHP files (2024)

When you see a ‘PHP file with mixed content’ mixed content file in your mixed content scan, the result cannot be fixed automatically. The scan does provide all the information required to fix the file manually. When seeing such a result in your scan overview, it will provide you with the location of the file. This is outlined in red in the example below.

Fix mixed content in PHP files (1)

The location will tell you exactly which file the mixed content is coming from. In this case, the mixed content is coming from the footer.php file in the Twenty Twenty theme folder. Now we know where the mixed content is coming from, but what causes it and how can we fix it?

To get more information about the result, press the ‘Details’ button on the right side of the page.

Fix mixed content in PHP files (2)

The detailed information contains a Blocked URL, this is the URL that cannot load over https:// and thus results in a mixed content warning.

Since we cannot fix the file automatically, you can press the ‘Edit’ button in the bottom right corner of the details popup. Pressing this button will take you to the file editor. In the file editor, we can then search for the Blocked URL:

Fix mixed content in PHP files (3)

To fix the issue, you can now add the image to your own media library (if you have permission from the image owner), and replace the image URL with the one on your own domain. Alternatively, you can remove the image entirely.

Any questions? Let us know and we’ll be happy to help!

Fix mixed content in PHP files (2024)

FAQs

How to fix mixed content issues in PHP? ›

Mixed content occurs when you attempt to load images or other content using HTTP instead of HTTPS. To fix this, all you need to do is edit the links on your page so that they start with HTTPS instead.

How to bypass blocked mixed content? ›

Enabling mixed content in Google Chrome
  1. Click the lock (caution) icon, then click Site settings.
  2. Scroll to Insecure content, then use the drop-down list to change “Block (default)” to “Allow.”
  3. Reload the VEC page.
Oct 10, 2023

How do I fix mixed content issue in Apache? ›

To fix mixed content issues, follow these general steps:
  1. Identify Mixed Content: ...
  2. Update URLs to HTTPS: ...
  3. Use Protocol-Relative URLs: ...
  4. Update CMS Settings: ...
  5. Update Plugins and Themes: ...
  6. Check for Hard-Coded HTTP Links: ...
  7. Update Content Delivery Network (CDN) Settings: ...
  8. Check Third-Party Services:
Mar 5, 2024

How to correct PHP errors? ›

The default error handler for PHP is the built in error handler. We are going to make the function above the default error handler for the duration of the script. It is possible to change the error handler to apply for only some errors, that way the script can handle different errors in different ways.

How can you handle errors in PHP? ›

Error Handling and Logging ¶
  1. debug_backtrace — Generates a backtrace.
  2. debug_print_backtrace — Prints a backtrace.
  3. error_clear_last — Clear the most recent error.
  4. error_get_last — Get the last occurred error.
  5. error_log — Send an error message to the defined error handling routines.

How do I allow blocked content? ›

For Chrome:
  1. Click on the shield in the right hand side of the URL text box (see image below).
  2. Then click on Site Settings.
  3. A list of permissions is displayed in a new browser tab. Find the Insecure content permission and change to Allow.
  4. Close the Settings tab to return to the original web page.

How do I fix insecure content blocked in Chrome? ›

Allow Insecure Content for the Specific Site:
  1. Visit the website in question.
  2. Click the lock icon in the address bar (left side).
  3. Select "Site Settings."
  4. Under "Insecure Content," choose "Allow."
Dec 30, 2023

How to fix mixed content errors in WordPress? ›

Resolving Mixed Content Errors
  1. Verify there is a valid SSL installed by clicking on the padlock icon. ...
  2. Configure the page to force HTTPS requests: ...
  3. Change your site's URL in the Settings > General page of your WordPress Admin Dashboard from HTTP to HTTPS.
  4. Purge WP Engine server caches.
  5. Purge browser cache OR,
Mar 8, 2024

What is mixed content HTTP vs HTTPS? ›

When an HTTPS website references insecure (HTTP) resources, this is called mixed content. Browsers prevent an HTTPS website from loading most insecure resources, like fonts, scripts, etc. Migrating an existing website from HTTP to HTTPS means identifying and fixing or replacing mixed content.

How to use multiple PHP versions in Apache? ›

To run multiple versions of PHP simultaneously on Apache, you will need to use the Apache module fcgid. This module allows you to use FastCGI to execute scripts, including PHP scripts, and can be used to specify the version of PHP that should be used for a particular virtual host.

How to fix insecure content was loaded over HTTPS but requested an insecure resource? ›

I had this error with an iframe to another website. I changed the src from "https://website.com/folder" to "https://website.com/folder/index.php" and for some reason it works. If you're using nginx as a reverse proxy, modify the ssl server block to include this line. In my case, the blocker was at the path.

How to fix internal server error in PHP? ›

How to Resolve 500 Internal Server Error
  1. Step 1: Debugging the Issue.
  2. Step 2: Empty . htaccess File.
  3. Step 3: Debug . htaccess Issues.
  4. Step 4: Increase PHP Memory Limit.
  5. Step 5: Check if the Admin Works.
  6. Step 6: Revert Recent Changes.
  7. Step 7: Audit Your Plugins/Extensions/Modules.
  8. Step 8: Check File Permissions.

How to fix mixed content in SSL? ›

How to Fix Mixed Content Issue?
  1. Step 1: Identify Mixed Content on the Page. ...
  2. Step 2: Check if the Resource is Available in HTTP and HTTPS. ...
  3. Step 3: Migrating an HTTP Resource to HTTPS. ...
  4. Step 4: Update the Source File. ...
  5. Step 5: Check Whether the Error Has been Resolved.
Jan 23, 2024

How to troubleshoot PHP website? ›

PHP offers a valuable tool for troubleshooting: error reporting. To enable error reporting, open PHP configuration file (php. ini) and set the 'display_errors' directive to 'On. ' This will display error messages on the web page, helping to identify the root causes of any issues.

Top Articles
Latest Posts
Article information

Author: Pres. Carey Rath

Last Updated:

Views: 6136

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Pres. Carey Rath

Birthday: 1997-03-06

Address: 14955 Ledner Trail, East Rodrickfort, NE 85127-8369

Phone: +18682428114917

Job: National Technology Representative

Hobby: Sand art, Drama, Web surfing, Cycling, Brazilian jiu-jitsu, Leather crafting, Creative writing

Introduction: My name is Pres. Carey Rath, I am a faithful, funny, vast, joyous, lively, brave, glamorous person who loves writing and wants to share my knowledge and understanding with you.