LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-30-2009, 10:37 PM   #1
doctorbow
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Rep: Reputation: 0
moving site to linux


I have a web site running on windows server 2003 PHP 5 and mysql 5 (everything is working) and I’m trying to move it to a Linux server (centos 5.3 interworx phpl 5 and mysql 5)I have copied the database over and set file permissions but I have one file assign script not working (I can add stuff to the database & remove stuff from the database so I know the database is working) what is difference between php and mysql on windows vs. Linux

if this is the wrong place to post can anyone tell me were i should post

thank you
James
 
Old 06-30-2009, 10:56 PM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
but I have one file assign script not working
Can you elaborate? What is a 'file assign' script? Error messages? Maybe post the code?

I'm not aware of differences (but that does not mean too much).
 
Old 06-30-2009, 11:59 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
At db level, and php level, they should be the same as long as the versions are compatible.

There are differences in the way you handle the fs, and that's probably your problem. Linux is sensible to the case for example, permissions might be an issue as well. That's about all I can say unless you give more details. Maybe taking a look at the script could help.
 
Old 07-01-2009, 10:39 AM   #4
doctorbow
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
i will try my best to explain

my fileassign script is just the the name of the script that i am having problems with

here is the first part
------------------------------------------------------------------------

<?
require("scripts/dbconfig.php");
require("scripts/adsec.php");
$uid=$_GET['uid'];
$userq=mysql_query("SELECT * FROM users WHERE uid='$uid'");
$firstname=mysql_result($userq,0,"firstname");
$lastname=mysql_result($userq,0,"lastname");
$email=mysql_result($userq,0,"email");

$memberq=mysql_query("SELECT * FROM memberships WHERE uid='$uid'");
$cid=mysql_result($memberq,0,"cid");

$compq=mysql_query("SELECT * FROM companies WHERE cid='$cid'");
$company=mysql_result($compq,0,"company");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FTS: Field Technical Services</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function checkrequired(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
}
}
}
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
// End -->
</script>
<style type="text/css">
<!--
.style3 {color: #999999}
-->
</style>
</head>

<style type="text/css" media="all">
@import "styles/default.css";
.style20 {color: #0000FF}
.style21 {color: #000000}
</style>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" rightmargin="0">
<div align="center">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60%" bgcolor="#FFFFFF" class="heading1">&nbsp;</td>
<td width="40%" bgcolor="#FFFFFF" class="copyright"><div align="right"><font color="#666666">Home | About Us | Data Library | Contact Us </font></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="372" align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/bar.jpg" width="800" height="30"></td>
</tr>
<tr>
<td height="342" align="left" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="0pxpaddingborder">
<tr>
<td height="19" align="left" valign="top" background="images/bg.gif" bgcolor="#333333"><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="798" height="90">
<param name="movie" value="flash/datalib.swf">
<param name="quality" value="high"><param name="LOOP" value="false">
<embed src="flash/datalib.swf" width="798" height="90" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></object></td>
</tr>
<tr bgcolor="#CC0000">
<td height="19" bgcolor="#CC0000" class="heading2">&nbsp;</td>
</tr>
<tr align="left" valign="top" bgcolor="#FFFFFF">
<td height="298">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="75%" height="297" align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" class="5padd-head"><strong> Administration </strong></td>
</tr>
<tr>
<td colspan="2" class="5padd"><p align="left" class="style3"><strong>Company Details </strong></p>
</tr>
<tr>
<td colspan="2" valign="top" class="5padd-border1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="5padd"><strong>Company:</strong></td>
<td class="5padd"><? echo $company; ?></td>
</tr>
<tr>
<td width="11%" class="5padd"><div align="left"><strong>First&nbsp;Name:</strong></div></td>
<td width="89%" class="5padd"><? echo $firstname; ?> </td>
</tr>
<tr>
<td class="5padd"><div align="left"><strong>Last&nbsp;Name:</strong></div></td>
<td class="5padd"><? echo $lastname; ?> </td>
</tr>
<tr>
<td class="5padd"><div align="left"><strong>Email&nbsp;Address:</strong></div></td>
<td class="5padd style20"><? echo $email; ?> </td>
</tr>
</table>
<br></td>
</tr>
<tr>
<td width="52%" valign="top" class="5padd"><span class="style3"><strong>Select the files to assign to this user... </strong></span></td>
<td width="48%" valign="top" class="5padd"><div align="right" class="style20"></div></td>
</tr>
<tr>
<td colspan="2" valign="top" class="5padd"><form name="form1" method="post" action="<? echo"scripts/assignfiles(user)sc.php?uid=$uid"; ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="lightborder">
<tr bgcolor="#666666">
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td width="3%" class="5padd-border1"><div align="center">-</div></td>
<td width="46%" class="5padd-border1"><strong>File Name </strong><strong></strong></td>
<td width="30%" class="5padd-border1"><div align="left"><strong>Last Updated </strong></div></td>
<td width="21%" class="5padd-border1"><div align="right"><strong>File Size </strong></div></td>
</tr>
<?
$fileq=mysql_query("SELECT * FROM files");
$fileqnum=mysql_num_rows($fileq);
$f=0;

if($fileqnum < 1){
echo"<tr bgcolor='#EEEEEE'><td class='5padd-border1' colspan='5'>There are no files in the database.</td></tr>";
}

while($f < $fileqnum){

$filename=mysql_result($fileq,$f,"filename");
$filesize=mysql_result($fileq,$f,"filesize");
$lastupdated=mysql_result($fileq,$f,"lastupdated");
$fid=mysql_result($fileq,$f,"fid");
$unixtime=mysql_result($fileq,$f,"unixtime");
if($lastupdated==0){ $lastupdated=$unixtime; }
$lastupdated=date("m/d/Y",$unixtime);

echo"<tr bgcolor='#EEEEEE'>
<td class='5padd-border1'><div align='center'>";
$qq=mysql_query("SELECT * FROM fileassign WHERE uid='$uid' AND fid='$fid'");
$qqnum=mysql_num_rows($qq);
if($qqnum < 1){
echo"<input type='checkbox' name='files[]' value='$fid'></div></td>";
}else{
echo"-</div></td>";
}
echo"<td class='5padd-border1'>$filename</td>
<td class='5padd-border1'><div align='left'>$lastupdated</div></td>
<td class='5padd-border1'><div align='right'>$filesize Bytes</div></td>

</tr>";



$f++;
}

?>
</table>
<p align="right">
<input type="submit" name="Submit" value="Assign Selected Files" class="TextField">
</p>
<p>&nbsp;</p>
</form>
<p>&nbsp;</p></td>
</tr>
</table></td>
<td width="25%" align="left" valign="top" bgcolor="#EFEEC7" class="leftborder">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="loginborder">
<tr>
<td height="170" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EFEEC7">
<tr>
<td valign="top" class="copyright"><strong>Logged&nbsp;in&nbsp;as: </strong><span class="style3">Administrator</span></td>
</tr>
</table><? require("adminnav.php"); ?>
</td>
</tr>
</table>
<div align="center"><br>
</div></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/grad3.gif" width="800" height="20"></td>
</tr>
<tr>
<td class="copyright2">&copy;Copyright 2006 Fts.<br>
This site was created by <u>Masterpiece Computers</u></td>
</tr>
</table>
</div>
</body>
</html>


------------------------------------------------------------------------
and here is the supporting script
------------------------------------------------------------------------

<?php require("dbconfig.php");
$uid=$_GET['uid'];
$time=time();

$files[]=$_GET['files'];


foreach($files as $file){
if($file <= ""){
}else{
$q1=mysql_query("SELECT lastupdated FROM files WHERE fid='$file'");
$filetime=mysql_result($q1,0,"lastupdated");
$q=mysql_query("INSERT INTO fileassign VALUES('0','$file','$uid','0','$filetime')") or die("could not create file membership");
}
}

echo "<meta http-equiv='REFRESH' content='0;url=../userdetails.php?uid=$uid'></HEAD>";

?>
-----------------------------------------------------------------------
i would go to i guy who made it but i can not find him
thank you to all that have helped just let me know if you need and more info

i have very little understanding of PHP so this makes it even more frustrating
 
Old 07-01-2009, 10:45 AM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hi,

For future reference (though you can edit your last post too and fix it) you should please use [code] tags around (long) chunks of code when posting them. It makes them more readable as well as not scrolling so long down the screen.

Thanks!

Sasha
 
Old 07-01-2009, 10:58 AM   #6
reptiler
Member
 
Registered: Mar 2009
Location: Hong Kong
Distribution: Fedora
Posts: 184

Rep: Reputation: 42
In addition to the regular permissions SELinux may something to keep in mind on CentOS. This could cause trouble even if the permissions seem to be correct.
 
Old 07-01-2009, 10:58 AM   #7
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
did you check the /var/log/httpd/error_log (or /var/log/apache2/error_log) file for errors?
 
Old 07-01-2009, 12:21 PM   #8
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
doctorbow,

You might need to be aware that linux and MS handle end-of-line codes differently. Linux uses LF ( 0x0A ) at the end of a line, and MS uses <CR><LF> ( 0x0d 0x0A )

So files created with notepad (or similar MS text editors) may not be functional when transferred to linux.

Check out the dos2unix and unix2dos utilities which will convert between one and the other.
 
Old 07-01-2009, 05:33 PM   #9
doctorbow
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
i have been talking with interworx tech support and they have not been any help
the site was built and tested on linux then moved to a windows server ( i dont know why)
i will look for any error messages ( need to find them because interworx(.com) moves stuff around)
SELinux is off i did check out dos2unix and the files are still the same

ok after looking the problem was a


$files[]=$_GET['files']; $files[]=$_POST not get

now i know thank you to all
James
G3reseller.com

Last edited by doctorbow; 07-01-2009 at 06:19 PM. Reason: rewrite
 
Old 07-01-2009, 11:37 PM   #10
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Hi doctor,

1)
So that was not really an Apache/PHP issue ?
2)
And just a tip:
You don't seem to be spending to much time on error checking I strongly suggest that you start adding that.
My scripts are 10% functionality and 90% checks; checking for errors (like the return value of the mysql_query statements) and user input validation.
 
Old 07-05-2009, 12:18 PM   #11
doctorbow
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
i am a total newbe to php. what is the best place online to learn more on php?
 
Old 07-05-2009, 03:46 PM   #12
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
what is the best place online to learn more on php?
The Internet, and the internet's search engines
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache site redirects using what rule? foo.site.com -> www.site.com/foo LaughingBoy Linux - Server 2 04-16-2009 09:51 PM
after moving web site to new server - certificate error loading https page jayunplugged Linux - General 3 03-06-2008 12:00 PM
Moving site home from WebHost - Help needed bence8810 Linux - Server 2 11-21-2006 03:29 PM
Moving to new site; critique my old site? Hosiah General 1 03-13-2006 03:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration