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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:25:57+00:00 2026-06-06T21:25:57+00:00

I have the following code setup for my admin_add in my photocategories_controller.php file. This

  • 0

I have the following code setup for my admin_add in my photocategories_controller.php file. This code works great in my CentOS development server at home. However, it does not work when I upload this file to my production server. Any help will be appreciated~

function admin_add() {
    .... //Other code here

    //On folder add, get its ID to be used as the name of the folder
    $folderID = $this->Photocategory->getLastInsertId();

    //This directory is already created
    $uploadDir = '/img/uploads/photos/';
    $serverRoot = $_SERVER['DOCUMENT_ROOT'];

    //Folder location to be created. When I print it I get
    // /home/xxxxxxx/public_html/img/uploads/photos/16 === 16 being the last inserted ID
    $directoryPath = $serverRoot.$uploadDir.$folderID;

    //I CANNOT FIGURE OUT WHAT AM I DOING WRONG HERE. IT WORKS IN MY DEVELOPMENT
    //SERVER, BUT NOT IN MY PRODUCTION SERVER       
    if(mkdir($directoryPath, 0777)){
        if(mkdir($directoryPath."/thumb", 0777)){
            $this->Session->setFlash('Success', 'default', array('class' => 'alert_success'));
        }else{
            $this->Session->setFlash('Error creating thumb', 'default', array('class' => 'alert_error'));
        }
    }else{
        $this->Session->setFlash('Error Creating Directory', 'default', array('class' => 'alert_error'));
    }   
  • 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-06-06T21:25:58+00:00Added an answer on June 6, 2026 at 9:25 pm

    SOLVED! I am not sure why, but my production server was not detecting my server root as I expected it to. It was seeing $serverRoot = $_SERVER['DOCUMENT_ROOT']; as the public_html folder. However I needed the webroot folder. So I used CakePHP’s own WWW_ROOT.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following setup: Sharepoint 2010 with SQL Server and Office 2010. This
I have this following code with Inno Setup. But how can I apply this
I have the following piece of code: // setup the AJAX request var pageRequest
I have the following code: [SetUp] public void SetMeUp() { Mapper.CreateMap<SourceObject, DestinationObject>(); } [Test]
I have the following code: if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { // Setup the
Ok so i have the following code setup which seems to work fine: user
I have this following code and i want to display images and other html
I have the following setup code: MockOf<IObjectSet<Dummy>>().Setup(c => c.AddObject(dummy)).Verifiable(); MockOf<IObjectContextWrapper>().Setup(c => c.GetObjectSet<Dummy>()).Returns(MockOf<IObjectSet<Dummy>>().Object); where Dummy
I have the following code: <?php if ($foo) { echo $foo; } ?> However,
I have the following setup: Code on my local machine (OS X) shared as

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.