Posted in

🛠️ Issue: “The file type is not a valid image” when using Social Login

When you are using social login (e.g., Facebook, Google, etc.), you may encounter the following error:

“The file type is not a valid image”

âť“ Why does this happen?

Although it may appear to be a bug in Sngine, the real cause is a server-side PHP configuration issue, specifically related to the setting:

allow_url_fopen

This PHP directive controls whether PHP can fetch files using URL-based paths (e.g., https://...). Sngine relies on this feature to download the user’s profile picture from the social login provider (like Facebook). If allow_url_fopen is disabled, PHP can’t access external URLs, and the image fetching fails—leading to the error message.


âś… How to Fix It

1. Check if allow_url_fopen is enabled

You can create a test PHP file with the following code and save it as test_allow_url.php :

<?php
if (ini_get('allow_url_fopen')) {
echo 'allow_url_fopen is enabled';
} else {
echo 'allow_url_fopen is disabled';
}

Upload this file to your /includes directory and access it via your browser.

Example: https://yourdomain.com/includes/test_allow_url.php

If it says “disabled”, then that’s the problem.

2. How to Enable It

If you are using shared hosting:

  • Check if you have access to PHP Selector or MultiPHP INI Editor in cPanel.
  • Look for allow_url_fopen and set it to On.

Still not fixed?

Alternatively, you can try creating a php.ini file and add it your /includes folder:

allow_url_fopen = On

Note: Some hosting providers may restrict this setting. If you can’t enable it yourself, contact your hosting support and ask them to enable allow_url_fopen for your account.

3. For VPS or Dedicated Servers

If you manage your own server, open your main php.ini file and make sure you have:

allow_url_fopen = On

Then restart your web server:

# Apache
sudo systemctl restart apache2

# Nginx + PHP-FPM
sudo systemctl restart php-fpm

âś… Final Thoughts

This issue is not a direct bug in Sngine but rather a server configuration that Sngine depends on. Ensuring allow_url_fopen is enabled on both root dir and also inside /includes dir will fix the image fetching issue during social login and help other features that rely on accessing remote files.


That’s it.

Happy Sngine 🙂

Buy Sngine or Extend your support: https://bit.ly/BuySngine