Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-18-2013, 08:35 PM   PM User | #1
countrydj
Regular Coder

 
Join Date: Nov 2011
Location: Preston, UK
Posts: 130
Thanks: 36
Thanked 0 Times in 0 Posts
countrydj is an unknown quantity at this point
I need to copy and rename a file

I am writing a simple script for a subscriber to create a simple web page.

I now need to copy and rename a file for use by another user.

This is the code that I am trying with and can't get it to work:
PHP Code:
        $old 'fr_addclub.php';
        
$new 'modify_club.php';
        
copy($old$new) or die("Unable to copy $old to $new."); 
This script that is running this is in the same directory as $old and where I want $new.

This is the response:
Quote:
Unable to copy fr_addclub.php to modify_club.php.
I have tried changing the file to .txt files, but that didn't work (as I expected).
I have changed file ownership to chmod 600 and chown to apache.apache and that hasn't worked.

Can anybody suggest what is wrong ??

Thanks,
__________________
The MAN, The MYTH, The LEGEND:
John C
________________________________
Support your local Country Music Club
countrydj is offline   Reply With Quote
Old 02-19-2013, 06:17 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Remove the or die, and add or print_r(error_get_last()); die(); and post that (or simply enable your error reporting).
If I had to guess, it's safe_mode restricted. Did you verify that the apache.apache is the name of the apache user? Also, is the ownership set on the directory itself?
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 02-20-2013, 12:11 AM   PM User | #3
countrydj
Regular Coder

 
Join Date: Nov 2011
Location: Preston, UK
Posts: 130
Thanks: 36
Thanked 0 Times in 0 Posts
countrydj is an unknown quantity at this point
Hi Fou-Lu
Once again you haver come to my rescue.
You are my knight in shining armour...

The problem was ownership. The file was owned by apache, but the directory was NOT owned by apache.
It is now.

Many thanks for the lead...

I have a new problem now, but that is for another thread.
__________________
The MAN, The MYTH, The LEGEND:
John C
________________________________
Support your local Country Music Club
countrydj is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:37 AM.


Advertisement
Log in to turn off these ads.