Jump to content

Archived

This topic is now archived and is closed to further replies.

piglith

PHP5 installation

Recommended Posts

Seems there is a lot of people having problems with php5 and osCommerce. I have no problems here. Maybe a site admin can sticky this.

 

 

 

What needs to be done is two things.

 

Before you install you must

 

1: Change in php.ini

register_globals = On

register_long_arrays = On

 

2: Change in catalog/admin/includes/classes/upload.php

on line 31 change

 

$this = null;

 

to

 

//$this = null;

 

 

 

Thats it. I have not found any ill effects as of yet.

Share this post


Link to post
Share on other sites

Just to second this fix - worked spot on for me!

 

Made the changes and all running well on my development box so far.

 

'register_long_arrays' fixed the problem with my store not dropping down a level from the front page - clicks always took me back to the front page again.

 

'$this' fix sorted out the non-display of the admin panel that had me playing with paths for ages!

 

Nice post!

Share this post


Link to post
Share on other sites

Hi ,

 

I noticed another reference to this in another thread,

 

advised change

 

$This = NULL;

 

to

 

unset($This);

 

not sure about the case, but you get the idea,

 

also

 

change

 

$PHP_SELF

to

$_SERVER['PHP_SELF'] (now an array in php 5 )

 

again not 100% sure on the case sensitivity, but should get you on the way.

 

Regards,

 

syk0


syk0

Share this post


Link to post
Share on other sites

Hi all,

 

when I run the install it goes through the database setup and import no problem, but then it throws me back to the install "welcome page" (The initial page where it asks you if its a new install or an upgrade from the xchange project). I never get to the "web server configuration" part.

 

Vger in the installation forum suggested its a PHP installation problem. so I ended up here...

 

My site is hosted by goDaddy.com on a linux box and its a shared hosting plan. "They" say I have both php 4 and 5 on the server (?) I have no clue where they keep the php.ini file, and even if I knew I dont think I would have access to it to change it.

Their tech support guy was more clueless then me (could you imagine ?)

 

They also informed me that they will not start the server for me... :blink:

 

Any suggestions ? Is there any hope ?

 

Zohar

Share this post


Link to post
Share on other sites

Hi,

 

I too am having problems with php5. I have updated my home development pc to run:

 

php 5.2.0

apache 2.2.3

mySQL 5.0.2.7

 

All of this is running on XP Pro sp2 and the lateste release of osC (osCommerce 2.2 Milestone 2 Update 060817)

 

My problem is that when I go to run the install process it cannot get past running the setup stage 2 (http://localhost:8080/osc/install/install.php?step=2), it hangs when hitting the continue button and leaves me with the install page half rendered in the browser window showing only the header.

 

I have tried making the changes suggested in this post but I am still drawing a blank.

 

I am working towards a <div> based layout shedding all references to <table>'s unless for tabular data and to fall at the install process is very frustrating especially as i am ready to test the layout and start re-inserting the php code into the classic template.

 

If anyone could suggest what might be going wrong i'd be eternally greatful.

 

Jamie

Share this post


Link to post
Share on other sites

Hello,

 

I am experiencing exactly the same problem as you Jamie.

  • Apache/2.0.59 (Win32)
  • PHP/5.1.4
  • MySQL 4.1.18
  • oscommerce-2.2ms2-060817

I even tried to set the user password using OLD_PASSWORD since there is not any connection to the database but without any success.

 

Patrick

Share this post


Link to post
Share on other sites

Hi,

 

I finally managed to install it Jamie.

 

Looking at the code, it seems that php stops while connecting to the database althought the connection parameters were correct.

 

Finally I have changed php.ini to use extension=php_mysql.dll instead of php_mysqli.dll (notice the 'i' after 'mysql') and then it works great !

 

 

Patrick

Share this post


Link to post
Share on other sites
Hi all,

 

when I run the install it goes through the database setup and import no problem, but then it throws me back to the install "welcome page" (The initial page where it asks you if its a new install or an upgrade from the xchange project). I never get to the "web server configuration" part.

 

Vger in the installation forum suggested its a PHP installation problem. so I ended up here...

 

My site is hosted by goDaddy.com on a linux box and its a shared hosting plan. "They" say I have both php 4 and 5 on the server (?) I have no clue where they keep the php.ini file, and even if I knew I dont think I would have access to it to change it.

Their tech support guy was more clueless then me (could you imagine ?)

 

They also informed me that they will not start the server for me... :blink:

 

Any suggestions ? Is there any hope ?

 

Zohar

 

Hi Zohar,

 

you have to make these changes if you are using php5:

 

$HTTP_GET_VARS change to $_GET

$HTTP_POST_VARS change to $_POST

 

in all php oscommerce files. :D

 

Cheers,

 

Sergio

Share this post


Link to post
Share on other sites

I am doing a move of an existing OSCommerce install to a new server with PHP5. I've made the $HTTP_GET_VARS and $HTTP_POST_VARS changes, and the changes by SKY0 seem to break my version of OSC so I undid those. The GET and POST changes fixed the major issue I was having (products not found), but the admin panel is still not showing up properly. It looks like this:

adminqa0.jpg

 

This one is using STS, and I think that might be part of the problem. Any ideas?

Share this post


Link to post
Share on other sites
This one is using STS, and I think that might be part of the problem. Any ideas?

I just did a clean install of the latest version of OSC, and am still getting the same look in the admin panel.

Share this post


Link to post
Share on other sites

Just a follow-up to this, because I ran into the same problem...

 

To fix this issue, I added this to the end of the admin/includes/languages/english.php file....

 

include_once("english/index.php");

 

Hopefully this will help someone else as the previous posts in this thread have already helped me.

Share this post


Link to post
Share on other sites

Hello,

 

After transferring from php4 to php5, I ran into a problem with the contri extra pages (page manager).

These are the comments:

 

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /www/s/o/l/solera.nl/public_html/admin/page_manager.php on line 591

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /www/s/o/l/solera.nl/public_html/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /www/s/o/l/solera.nl/public_html/admin/includes/classes/object_info.php on line 18

 

Can anyone advise me please?

 

Thanks in advance

Rene

Share this post


Link to post
Share on other sites
Any idea where I'll find php.ini

 

I've searched the site and don't have one

 

Thanks

 

Steve

 

Thank you SO MUCH!!! the change to the upload file in admin restored my store!!!!!!! Yeah Yeah Yeah!

Share this post


Link to post
Share on other sites

Am using php5, apache2.2.4 before installing i did the changes like,

 

1: Change in php.ini

register_globals = On

register_long_arrays = On

 

2: Change in catalog/admin/includes/classes/upload.php

on line 31 change

 

$this = null;

 

to

 

//$this = null;

 

 

 

$this = null; line was not found in my file.

 

When i try to run my installation it gives an error like:

FATAL ERROR: register_globals is disabled in php.ini, please enable it!

 

I have enabled na, whats the problem???

Share this post


Link to post
Share on other sites
Seems there is a lot of people having problems with php5 and osCommerce. I have no problems here. Maybe a site admin can sticky this.

What needs to be done is two things.

 

Before you install you must

 

1: Change in php.ini

register_globals = On

register_long_arrays = On

 

2: Change in catalog/admin/includes/classes/upload.php

on line 31 change

 

$this = null;

 

to

 

//$this = null;

Thats it. I have not found any ill effects as of yet.

 

I have php5 on my test server and have found that some contibutions have

 

<? to start the php code. This seems to cause problems. So I would suggest a global find and replace looking for <? to replace with <?php

 

Note the space after <? in the search, otherwise you may end up with <?phpphp


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

I have done the changes listed below and still have some problems.

 

Reviews page is now blank and add to cart button on product page does work.

 

Has anyone had similar problems?

 

I am on PHP 5.2.2, MySQL 4.1.20 and Apache/2.0.52 (Red Hat)

 

I have changed all instances of $HTTP_GET_VARS to $_GET and $HTTP_POST_VARS to $_POST and also added "register_long_arrays = On" into my .htaccess file.

 

The only change I haven't made was to comment out

$this = null;

as it doesn't appear in the file!

 

Would anyone have any suggestions please?

 

Thanks,

Simon


Gynogapod - Great Products, Tiny Prices!

Share this post


Link to post
Share on other sites

Hello,

 

I have gone through the php adaptations.

They seem to work;

BUT the checkout_process page does NOT pass the oders to the admin beacuse of the following incompatible code:

 

$myFile = "checkout_process.log";

$fh = fopen($myFile, 'a');

foreach ($_SESSION as $key => $value) {

$my_string .= "$key => $value \r\n";

if (is_array($value)) {

foreach ($value as $key1 => $value1) {

$my_string .= "\t$key1 => $value1 \r\n";

 

Any idea how to solve this?

Are there OTHER bugs to be reckoned with?

TIA

Hugo

 

PHP5.2 !!

Share this post


Link to post
Share on other sites
Hello,

 

I have gone through the php adaptations.

They seem to work;

BUT the checkout_process page does NOT pass the oders to the admin beacuse of the following incompatible code:

 

$myFile = "checkout_process.log";

$fh = fopen($myFile, 'a');

foreach ($_SESSION as $key => $value) {

$my_string .= "$key => $value \r\n";

if (is_array($value)) {

foreach ($value as $key1 => $value1) {

$my_string .= "\t$key1 => $value1 \r\n";

 

Any idea how to solve this?

Are there OTHER bugs to be reckoned with?

TIA

Hugo

 

PHP5.2 !!

Sorry, where did this code come from?


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
I have php5 on my test server and have found that some contibutions have

 

<? to start the php code. This seems to cause problems. So I would suggest a global find and replace looking for <? to replace with <?php

 

Note the space after <? in the search, otherwise you may end up with <?phpphp

And <?= with <?php= (I think).

 

Also, I think that you only have to do

http://svn.oscommerce.com/fisheye/changelo...mmerce/?cs=1583

 

http://svn.oscommerce.com/fisheye/changelo...mmerce/?cs=1584

 

but adapt using the latest OSC files. It would be nice to know for sure, but I doubt that I will find out.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

With the recent announcement that PHP will no longer support version 4 all hosts are advising clients to make sure their php scripts work with PHP5 and it just so happens that osC2.2MS2 doesn't so I'm glad I found this thread. I've started migrating several carts to PHP and the first one went through with flying colors but the last three have been giving me fits and I can't figure out what's wrong.

 

First I was getting the standard, "Your server has register globals off" message so I added the lines into my .htaccess file and I was able to see the sites but when I tried to click on the categories or product links it keeps going to 404 pages.

 

See here: testing.butlersystem.com/store/index.php

 

At first I thought it was the Ultimate SEO URL's module but after turning them off it just gets worst as the the pages keeps trying to find the page but it just ends up in a loop. After a while FF3 says

Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

 

This is all being done on test servers so the live sites are not being affected. What really bothers me is the fact that this modded version of osC is the same as the first cart that I migrated to PHP5 yet that one works and this one does not.


Samuel Mateo, Jr.

osC 2.2 MS2

Installed Mods:

WYSIWYG HTMLArea 1.7 | Basic Template System 1.0 | osC-Affiliate | OSC-SupportTicket

Featured Products 1.3 | LoginBox 5.2 | LatestNews 1.1.3 | Extras for IE

Share this post


Link to post
Share on other sites
With the recent announcement that PHP will no longer support version 4 all hosts are advising clients to make sure their php scripts work with PHP5 and it just so happens that osC2.2MS2 doesn't so I'm glad I found this thread. I've started migrating several carts to PHP and the first one went through with flying colors but the last three have been giving me fits and I can't figure out what's wrong.

 

First I was getting the standard, "Your server has register globals off" message so I added the lines into my .htaccess file and I was able to see the sites but when I tried to click on the categories or product links it keeps going to 404 pages.

 

See here: testing.butlersystem.com/store/index.php

 

At first I thought it was the Ultimate SEO URL's module but after turning them off it just gets worst as the the pages keeps trying to find the page but it just ends up in a loop. After a while FF3 says

 

 

This is all being done on test servers so the live sites are not being affected. What really bothers me is the fact that this modded version of osC is the same as the first cart that I migrated to PHP5 yet that one works and this one does not.

I found the problem. Not sure if anybody else will run into this but, If you have Ultimate SEO installed make sure the RewriteBase path is set correctly. Though the path had been wrong for a long time PHP4 had not really been bothered by it but when osC was moved to PHP5 it right away had problems.


Samuel Mateo, Jr.

osC 2.2 MS2

Installed Mods:

WYSIWYG HTMLArea 1.7 | Basic Template System 1.0 | osC-Affiliate | OSC-SupportTicket

Featured Products 1.3 | LoginBox 5.2 | LatestNews 1.1.3 | Extras for IE

Share this post


Link to post
Share on other sites
Seems there is a lot of people having problems with php5 and osCommerce. I have no problems here. Maybe a site admin can sticky this.

 

 

 

What needs to be done is two things.

 

Before you install you must

 

1: Change in php.ini

register_globals = On

register_long_arrays = On

 

2: Change in catalog/admin/includes/classes/upload.php

on line 31 change

 

$this = null;

 

to

 

//$this = null;

 

 

 

Thats it. I have not found any ill effects as of yet.

 

 

 

 

 

 

 

The network administrator at a client's host provider recommended this fix for getting oscommerce to install under php5

 

I went to make the changes in the upload.php file and do not see any place that $this = null shows up on line 31.

below is copy of the file, I would be grateful if someone could show me the answer here...

thanks in advance.

 

***************************

 

<?php

/*

$Id: upload.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 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 {

return false;

}

}

}

 

function parse() {

global $HTTP_POST_FILES, $messageStack;

 

$file = array();

 

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($HTTP_POST_FILES[$this->file])) {

$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']);

}

 

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;

}

}

}

?>

 

 

 

if anyone could show me where this $this=null needs to commented out, I would appreciate it...

Share this post


Link to post
Share on other sites

×