code in Win does not work on Linux!?

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
georgeT
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Apr 03, 2017 3:57 pm

code in Win does not work on Linux!?

Post by georgeT » Mon Apr 03, 2017 4:01 pm

I developed an app (PHP) in Windows using Eclipse for Windows and everything works like it should be.
Now, I brought the app to Eclipse on Linux and it does NOT wont to work!?
Would anyone have any idea why the app does not want to work in Eclipse on Linux?
Thanks. :-x

georgeT
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Apr 03, 2017 3:57 pm

Re: code in Win does not work on Linux!?

Post by georgeT » Mon Apr 03, 2017 4:27 pm

this is the code:

Code: Select all

// 2 values are collected from web page via $_POST

$value = filled_out($_POST);
echo "true/false -- ". $value . " -- "; // no value here
if(!$value){				// always fails
	echo"  display_hh('Problem:')";
}...


function filled_out($form_vars){
	echo" test that each variable has a value";
	foreach ($form_vars as $key => $value){
		if (!isset($key) || ($value === ''))
			echo 'no values!';
			return false;
	}
	echo 'yes values!';
	return true;
}

chorn
php-forum Active User
php-forum Active User
Posts: 300
Joined: Fri Apr 01, 2016 2:18 am

Re: code in Win does not work on Linux!?

Post by chorn » Mon Apr 03, 2017 9:43 pm

it does NOT wont to work
what should that mean to anybody not familar with the intention of your application? what error messages do you get, how far does your program work? at least this is not even valid PHP code and parts are missing.

NigelRen
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Re: code in Win does not work on Linux!?

Post by NigelRen » Mon Apr 03, 2017 11:44 pm

Don't know if this helps, but one huge difference between Windows and Linux is that Linux is case sensitive in file names. So there are problems with files called Database.php, database.php, DataBase.php as Linux will see them all as different files.

georgeT
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Apr 03, 2017 3:57 pm

Re: code in Win does not work on Linux!?

Post by georgeT » Tue Apr 04, 2017 10:17 am

This code worked in previous version of PHP. I had it out there already. So, I did find some discrepancies that only new version of PHP catches. I developed it on Win and port it to Linux and it worked. I got rid off it since it is not supported any more.
Thanks.

hyper
php-forum Active User
php-forum Active User
Posts: 286
Joined: Mon Feb 22, 2016 5:52 pm

Re: code in Win does not work on Linux!?

Post by hyper » Tue Apr 04, 2017 1:04 pm

Try running this little script:

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

function test_array ($array, $array_name) {

  echo "<br>isset(&dollar;$array_name) returns: ";
  
  if (isset($array)){
    echo 'True<br>';
  } else {
    echo 'False<br>';
  }

  echo 'Each element:<br><br>';
  
  foreach ($array as $key => $value) {

    echo "isset(&dollar;$array_name ['$key']) returns: ";
    
    if (isset($key)){
      echo 'True<br>';
    } else {
      echo 'False<br>';
    }

    echo "if (&dollar;$array_name ['$key'] === '') returns: ";
    
    if ($value === ''){
      echo 'True<br>';
    } else {
      echo 'False<br>';
    }
  }
  echo '<br>';
}

# declare arrays to test

$one = ["mark one", "From the others"];
echo "Running:<br>";
test_array ($one,'one');

test_array ($_POST, '_POST');

$_POST ['submit'] = true;
$_POST ['name'] = 'Dorris';
$_POST ['number'] = 1234;

test_array ($_POST, '_POST');
?>

georgeT
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Apr 03, 2017 3:57 pm

Re: code in Win does not work on Linux!?

Post by georgeT » Sun Apr 16, 2017 8:49 am

Thanks for the help. I got it to work to a point, interestingly it worked fine in Win and does not work on Lin. I need to first update to latest PHP.
Thanks.

georgeT
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Apr 03, 2017 3:57 pm

Re: code in Win does not work on Linux!?

Post by georgeT » Sun Apr 16, 2017 9:03 am

Hyper, what is the purpose of the script? I get nothing on the screen!?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests