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 6345251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:47:12+00:00 2026-05-24T20:47:12+00:00

I want to upload a Zend Framework Project to a site where safe_mode is

  • 0

I want to upload a Zend Framework Project to a site where “safe_mode” is on and I can’t controll it.

I get the following warning message from PHP:

PHP Warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid/gid is 954/815 is not allowed to access /tmp owned by uid/gid 0/0 in /blabla/phpapps/include/library/Zend/Cache/Backend.php on line 185

I don’t use Zend_Cache, so why is safe_mode angry about my script?

How do I set a default /tmp directory in my project to avoid this error?

thx

  • 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-24T20:47:14+00:00Added an answer on May 24, 2026 at 8:47 pm

    I don’t use Zend_Cache, so why is safe_mode angry about my script?

    Because Zend_Cache is also used internally from some other ZF components (Zend_Db, Zend_Translate and so on).

    How do I set a default /tmp directory in my project to avoid this error?

    You have two choices here:

    1. Track down what component uses Zend_Cache and configure it to use a custom instance of cache with a defined backend which doesn’t use /tmp storage (check for Apc or Memcached)
    2. Look at Zend_Cache_Backend implementation near line 185 and update your code to avoid that error.

    I would choose option 1 for better performances (apc or memcached are faster storage than filesystem) and for having more control on what’s happening in your project. However this could require more than one change for your project, because there could be more than one component which need to be configured.

    If you choose option 2 you could hack the whole thing with a single change and it will reflect all the components which uses a default cache instance, but since your hacking your code to work with an internal implementation future releases of ZF could break your code. That said you could achieve this by defining an ENV or SERVER variable with one of the keys that ZF checks for. These are the lines before where your warning is raised:

    public function getTmpDir()
    {
        $tmpdir = array();
        foreach (array($_ENV, $_SERVER) as $tab) {
            foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
                if (isset($tab[$key])) {
                    if (($key == 'windir') or ($key == 'SystemRoot')) {
                        $dir = realpath($tab[$key] . '\\temp');
                    } else {
                        $dir = realpath($tab[$key]);
                    }
                    if ($this->_isGoodTmpDir($dir)) {
                        return $dir;
                    }
                }
            }
        }
    

    So a code like this in the bootstrap will solve your issue:

    // I assume you're using the default ZF project structure
    // and that your-root/data/tmp is both writable and readable for
    // the webserver user, because the _isGoodTmpDir method will check for that
    $_SERVER['TMP'] = APPLICATION_PATH . '/../data/tmp';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know how can i use Zend Framework in my php project
I want to upload an image in Zend-framework. In Application_Form_Test.php I write following code....
I am a php programmer, but new to zend framework. I want to upload
I want to upload an image with Zend Framework version 1.9.6. The uploading itself
I am new in Zend Framework and learning it. I want to upload image
Hello I wanted to upload my web project done with zend framework on my
I want to upload a file to my server from some application. How can
Hi all I am using Zend framework for my PHP project. Basically I have
I want to upload file with have only file path in php. Can anyone
I'm using CodeIgniter + Zend libraries. I want to let users upload videos to

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.