Jump to content

My Software on Different php.ini settings


benn600

Recommended Posts

I wrote a basic content management system and want to set it up on another server.  On my server, it works great.  On this other server, I can't get it to function properly.  It shows tons of errors.  The first errors were that I was not passing values to all function inputs.  Is this horrible programming practice?  If I create a function with three inputs, sometimes I really only need one input.  The quick fix is to add ='' after each input variable, right?  So I did that and 80% of the errors disappeared.  Now I have some PHP/MySQL errors.  Here are a few.

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\[...]\siteroot\nunemaker\includes\functions.inc.php on line 68

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\[...]\siteroot\nunemaker\includes\template.inc.php on line 41

 

I really appreciate any assistance on this!

The first error I see on the page refers to this line in my code:

if (!mysql_num_rows($input))

 

So I changed it, adding the error item:

if (! (mysql_num_rows($input) or die(mysql_error())) )

 

Then I get this error and it dies:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\[...\\includes\functions.inc.php on line 68

 

Is there a chance the server has older PHP or MySQL?  The top line of code is the first line of code in the offending function.  The function is:

function badPageExit($input='')

 

I added ='' on all my inputs everywhere because the php.ini file must be configured differently from mine as my server allows this less strict programming style.

Yes, but I have die in my select queries...all of them.  I use this function to handle all my select queries.

 

function handleSelect($q='',$test='')

{

handleTest($q,$test);

$queryResult = mysql_query($q) or die(mysql_error());

if (mysql_num_rows($queryResult) > 0) return $queryResult;

else return 0;

}

I solved the problem by removing some logic:

 

  if (mysql_num_rows($queryResult) > 0) return $queryResult;

  else return 0;

 

changed to just

    return $queryResult;

 

Now my photo gallery upload is having some trouble.  I'm seeing these errors after trying to upload a picture:

 

Warning: move_uploaded_file(c:\[...]\gallery\full\14.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\[...]\includes\functions.inc.php on line 635

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'c:\php5\uploadtemp\php5323.tmp' to 'c:\[...]\gallery\full\14.jpg' in C:\[...]\includes\functions.inc.php on line 635

 

 

I tried chmoding the folders but they are already 666 (read and write (no execute)).  Would this work?  But when I tried 777 it didn't take.  Of course this is probably something to do with my host.  What do you suggest?

Problem solved.  I tried chmod-ing as I should in FTP but it didn't take.  Assuming it was my mistake, I posted unsure.  Well, after contacting my host, they told me I have to chmod through the web admin interface.  Doing so solved the problem.  Thanks for reading!

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.