Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6027201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:33:26+00:00 2026-05-23T04:33:26+00:00

I host my site on a shared hosting, which lately changed the server to

  • 0

I host my site on a shared hosting, which lately changed the server to safe mode (without even notifying that).
I use a feature that download files from the server, using the readfile() function (I use php).
Now, in safe_mode, this function is no longer available.
Is there a replacement or a workaround to handle the situation that the file will be able to be downloaded by the user?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:33:27+00:00Added an answer on May 23, 2026 at 4:33 am

    As I wrote in comments, readfile() is disabled by including it in disable_functions php.ini directive. It has nothing to do with safe mode. Try checking which functions are disabled and see if you can use any other filesystem function(-s) to do what readfile() does.

    To see the list of disabled functions, use:

    var_dump(ini_get('disable_functions'));
    

    You might use:

    // for any file
    $file = fopen($filename, 'rb');
    if ( $file !== false ) {
        fpassthru($file);
        fclose($file);
    }
    
    // for any file, if fpassthru() is disabled
    $file = fopen($filename, 'rb');
    if ( $file !== false ) {
        while ( !feof($file) ) {
            echo fread($file, 4096);
        }
        fclose($file);
    }
    
    // for small files;
    // this should not be used for large files, as it loads whole file into memory
    $data = file_get_contents($filename);
    if ( $data !== false ) {
        echo $data;
    }
    
    // if and only if everything else fails, there is a *very dirty* alternative;
    // this is *dirty* mainly because it "explodes" data into "lines" as if it was
    // textual data
    $data = file($filename);
    if ( $data !== false ) {
        echo implode('', $data);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i host my web site in shared hosting server, this server use the default
We've got a shopping site which we're hosting on a shared host (Mediatemple Gridserver).
i host my web site into a shared hosting and i need to set
I am using a shared hosting service to host my site so I can't
im using a shared hosting company to host my site and db. they are
I'm trying to host a PHP web site that was given to me. I
I'm trying to host a subdomain for my site with a different hosting company
my site keeps going down on my shared hosting account and this is what
One of my site is on a shared hosting and every few days the
I have a WSS site on a shared third-party host. I have a solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.