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

  • Home
  • SEARCH
  • 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 4240552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:10:48+00:00 2026-05-21T03:10:48+00:00

I am trying to do a really basic rename of a file to another

  • 0

I am trying to do a really basic rename of a file to another name in my code. However there seems to be some ownership/permissions problem that is stopping this working correctly.

This is my (simplified) code:

ini_set ("display_errors", "1");
error_reporting(E_ALL);

$St_Num = '7940';
$Co_Code = 'RDCO2';

rename("$St_Num-$Co_Code-1.jpg", "$St_Num-$Co_Code-4.jpg");

These are my permissions of the files I am trying to change:

Code:

-rw-r--r-- 1 apache dev   4065 Oct 22 17:57 7940-RDCO2-3.jpg
-rw-r--r-- 1 apache dev   4276 Oct 28 09:39 7940-RDCO2-2.jpg
-rw-r--r-- 1 apache dev   4336 Oct 28 09:39 7940-RDCO2-1.jpg

This code was working, and it seemed to work when apache was the creator of the file. However, when I changed the ownership to ‘apache’ it stopped working. Does PHP/Apache have a concept of knowing who the creator of a file was? Would this stop a rename() from working?

I’m stumped with this one now – any help is appreciated.

Thanks,
Picco

  • 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-21T03:10:49+00:00Added an answer on May 21, 2026 at 3:10 am

    do chmod(0666) [on the server] to give all users (including apache) write rights

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

Sidebar

Related Questions

Really stuck on trying to write code to unzip a file or directory on
Trying to do some really basic math here, but my lack of understanding of
I'm trying to do some really basic AJAX using PHP & jQuery, but for
In trying to solve the ajax back button problem I have found the Really
I have a really basic question concerning unix timestamp and mysql date. I'm trying
I am having difficulty with something really basic. I am trying to implement a
I'm new to Android and I think I'm trying to do something really basic:
This seems like a really basic thing that I'm doing, yet I'm tearing my
Really stupid C question. I'm trying to build the source code here so I
This must be a really basic question: I am trying to use Matplotlib. Here's

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.