Unikate Posted March 26, 2005 Posted March 26, 2005 Hi, I just found this solution for the php5/osc problem "The only thing you need to do to get osCommerce and php5 to work together is to go to admin/includes/classes/upload.php and on line 31 where you see $this change it to //$this." and would like to try it, but my text editor does not show me the upload.php in correct lines (the entire file has only 6 lines!). Could somebody please tell me which "this" I need to change? Thanks Kate
OceanRanch Posted March 26, 2005 Posted March 26, 2005 If you have php5 and go to your admin page you'll get an error message that point to the file. There is only one upload.php file and its in admin/includes/classes/upload.php. Perhaps someone has already edited that file and removed ALL the code. The standard upload.php is 183 lines. You may need to get a fresh copy from the standard osCommerce .zip file. HTH Tom
Unikate Posted March 26, 2005 Author Posted March 26, 2005 Hi Tom, I have copied the entire code of my upload.php file below - where is line 31/where do I need to make the change?? Thanks Kate <?php /* $Id: upload.php,v 1.2 2003/06/20 00:18:30 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ class upload { var $file, $filename, $destination, $permissions, $extensions, $tmp_filename, $message_location; function upload($file = '', $destination = '', $permissions = '777', $extensions = '') { $this->set_file($file); $this->set_destination($destination); $this->set_permissions($permissions); $this->set_extensions($extensions); $this->set_output_messages('direct'); if (tep_not_null($this->file) && tep_not_null($this->destination)) { $this->set_output_messages('session'); if ( ($this->parse() == true) && ($this->save() == true) ) { return true; } else { // self destruct $this = null; return false; } } } function parse() { global $messageStack; if (isset($_FILES[$this->file])) { $file = array('name' => $_FILES[$this->file]['name'], 'type' => $_FILES[$this->file]['type'], 'size' => $_FILES[$this->file]['size'], 'tmp_name' => $_FILES[$this->file]['tmp_name']); } elseif (isset($GLOBALS['HTTP_POST_FILES'][$this->file])) { global $HTTP_POST_FILES; $file = array('name' => $HTTP_POST_FILES[$this->file]['name'], 'type' => $HTTP_POST_FILES[$this->file]['type'], 'size' => $HTTP_POST_FILES[$this->file]['size'], 'tmp_name' => $HTTP_POST_FILES[$this->file]['tmp_name']); } else { $file = array('name' => (isset($GLOBALS[$this->file . '_name']) ? $GLOBALS[$this->file . '_name'] : ''), 'type' => (isset($GLOBALS[$this->file . '_type']) ? $GLOBALS[$this->file . '_type'] : ''), 'size' => (isset($GLOBALS[$this->file . '_size']) ? $GLOBALS[$this->file . '_size'] : ''), 'tmp_name' => (isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : '')); } if ( tep_not_null($file['tmp_name']) && ($file['tmp_name'] != 'none') && is_uploaded_file($file['tmp_name']) ) { if (sizeof($this->extensions) > 0) { if (!in_array(strtolower(substr($file['name'], strrpos($file['name'], '.')+1)), $this->extensions)) { if ($this->message_location == 'direct') { $messageStack->add(ERROR_FILETYPE_NOT_ALLOWED, 'error'); } else { $messageStack->add_session(ERROR_FILETYPE_NOT_ALLOWED, 'error'); } return false; } } $this->set_file($file); $this->set_filename($file['name']); $this->set_tmp_filename($file['tmp_name']); return $this->check_destination(); } else { if ($this->message_location == 'direct') { $messageStack->add(WARNING_NO_FILE_UPLOADED, 'warning'); } else { $messageStack->add_session(WARNING_NO_FILE_UPLOADED, 'warning'); } return false; } } function save() { global $messageStack; if (substr($this->destination, -1) != '/') $this->destination .= '/'; if (move_uploaded_file($this->file['tmp_name'], $this->destination . $this->filename)) { chmod($this->destination . $this->filename, $this->permissions); if ($this->message_location == 'direct') { $messageStack->add(SUCCESS_FILE_SAVED_SUCCESSFULLY, 'success'); } else { $messageStack->add_session(SUCCESS_FILE_SAVED_SUCCESSFULLY, 'success'); } return true; } else { if ($this->message_location == 'direct') { $messageStack->add(ERROR_FILE_NOT_SAVED, 'error'); } else { $messageStack->add_session(ERROR_FILE_NOT_SAVED, 'error'); } return false; } } function set_file($file) { $this->file = $file; } function set_destination($destination) { $this->destination = $destination; } function set_permissions($permissions) { $this->permissions = octdec($permissions); } function set_filename($filename) { $this->filename = $filename; } function set_tmp_filename($filename) { $this->tmp_filename = $filename; } function set_extensions($extensions) { if (tep_not_null($extensions)) { if (is_array($extensions)) { $this->extensions = $extensions; } else { $this->extensions = array($extensions); } } else { $this->extensions = array(); } } function check_destination() { global $messageStack; if (!is_writeable($this->destination)) { if (is_dir($this->destination)) { if ($this->message_location == 'direct') { $messageStack->add(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error'); } else { $messageStack->add_session(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error'); } } else { if ($this->message_location == 'direct') { $messageStack->add(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error'); } else { $messageStack->add_session(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error'); } } return false; } else { return true; } } function set_output_messages($location) { switch ($location) { case 'session': $this->message_location = 'session'; break; case 'direct': default: $this->message_location = 'direct'; break; } } } ?>
OceanRanch Posted March 26, 2005 Posted March 26, 2005 Change line 31 (its at line 31) from $this = null; to // $this = null; HTH Tom
Unikate Posted March 27, 2005 Author Posted March 27, 2005 Hi Tom, thanks for your reply! >Change line 31 (its at line 31)< LOL - the only problem is that I can't see or count where line 31 is... I don't know PHP (yet) and have no idea where one line starts or ends - and my editor doesn't show it either! But the "this = null" helped - I found it in the search function and changed it. Only problem is that this step didn't change anything... I am still stuck on page 2 of the installation routine (and I thought that this was due to the php5 thing...) Any ideas? Kate
OceanRanch Posted March 27, 2005 Posted March 27, 2005 LOL, this is the first time you mentioned that you were still installing. As I recall (since you haven't given me a clue) step 2 is when you connect to the database. If so then make sure that you have created a mysql "database" maybe called osc and that you have a valid user name and password on the mysql database. Normal the settings of Server: localhost User: yourname Password: yourpassword Database: osc (if that's what you called it) will get you going. If not then close this thread out and open another thread under installation/configuration and give as much details about the step you are in and the specific error message you are having. HTH Tom
Unikate Posted March 27, 2005 Author Posted March 27, 2005 >LOL, this is the first time you mentioned that you were still installing.< oops - sorry, that is because I posted all of these questions on the German forum already and forgot to mention it again! Yes, I am still installing and was very happy to see the "welcome screen" a few days ago, but then clicked on ("please choose the installation method to continue - install a new online store"), got to the next window ("New installation - please customize with ... import database and automatic configuration") Both boxes are already checked, but when I click on "continue", nothing happens except for the fact that the browser now shows "http://www.xxx.de/oscommerce/catalog/install/install.php?step=2 I don't even get a chance to enter the server and user names etc. Reading through the German forum and parts of this one I figured that the problem was due to the fact that my provider uses php5, that's why I wanted to install this solution. I will start a new thread on Monday - now it's time for bed and tomorrow is Easter Sunday with family and a big lamb roast!! Good night! Kate
Recommended Posts
Archived
This topic is now archived and is closed to further replies.