Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ftp_put issue after hosting server change

Posted on 2009-07-08
3
Medium Priority
?
335 Views
Last Modified: 2013-12-13
This install script used to work fine on my old server, however not working on the new one.

The errors start at ftp_put then continue throughout the script.  

The key seams to be that the IF statement is not returning the same output as on the previous server.  I think this because the ftp_put IS causing the file to be written to the expected location.  If i remove conditional IF statement and just hard code the ftp_put, the file gets written, but then triggers the error on the ftp_delete  in the following line.

On the old server the instructions said to "chmod the directory to 777" but on this new server that causes an "Internal Server Error" and must stay at 755, but its still possible to write.

I don't have 'root' access to this server.  Ideas as to how to fix it so the install script will work please.
if (@ftp_chdir($conn_id, $basedir) === FALSE)
	error("can not change directory to: $basedir");
if (!@ftp_put($conn_id, $tempfile, $temppath, FTP_ASCII)) 
	error("can not write to file: $tempfile.");
 
if (!ftp_delete($conn_id, $tempfile))
	error("could not delete: $tempfile. ");

Open in new window

0
Comment
Question by:ussher
3 Comments
 
LVL 20

Accepted Solution

by:
NerdsOfTech earned 750 total points
ID: 24809439
first try:

<?php
chmod("/somedir", 0777) or die ("access denied");
?>

Open in new window

0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 750 total points
ID: 24815578
Consider removing the @-sign notation - you would want to see the PHP notices and messages when you are debugging this issue, right?
0
 
LVL 1

Author Closing Comment

by:ussher
ID: 31601045
Thanks for the help Guys, Im going to remove the FTP part of the code and approach everything from a different angle.  So although i didnt find the solution, im not looking for it anymore.  Split the points to close the question.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article discusses how to implement server side field validation and display customized error messages to the client.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question