Warning: mktime() expects parameter to be long

Warning: mktime() expects parameter to be long, string given in

Image hot linking
stop hot linking
Redirect hot linked images

Only knowing the most basic of php and mysql coding this one had me stumped for some time before I came across the answer.

A friend of mine had bought the phpmydirectory script, from hot scripts I think, some time ago (version 10. something?) and never really did anything with for ages. Years later he decided to set up a directory for a project he was working on using this old script. Everything seemed to work ok on the old phpmydirectory script until he was testing it out from an advertisers point of view.

The error "Warning: mktime() expects parameter 6 to be long" was being returned on the front end part of the site.

I looked around Google and several other search engines but couldn't find a definitive answer to this problem. While searching for a solution to this problem I also noticed many others were also seeking the same answer. People using vbullitin, joomla, wordpress and many many websites which looked to be using the same version of the phpmydirectory script. Just copy the title of this page into google and you'll see many websites which show this warning and don't seem to have done anything about it, either they don't know or they don't care that their website looks a mess.

Well for all those messy looking websites out there displaying this horrible error code all over your pages there is a simple answer. This may not work for those sites using vbullitin, wordpress, joomla etc but it has got to be worth a try.

To cut a long story short I found the answer (which worked for my friends phpmydirectory) by reading a php manual. It basically has something to do with the version of php you are using on your server.

For all those using phpmydirectory v10.x.x and getting this mktime warning try the following...

Find the file includes/functions.php or find the file in question which is receiving the error

find all the instances of where it say mktime()

DELETE THE 'mk'

so it just says time()

Worked like a dream for my friends directory script!!!

Like I mentioned above it may not work for other scripts but it's got to be worth a try

Home page

If you feel this information has been of benefit for you please make a donation. Even the smallest amount will help to keep this site up and running and enable me to add more helpful info on other subjects/problems I come accross.

Please feel free to leave comments below or provide other information on this problem.



 

 

 

 

Articles, reviews, tips, views and news