Timeout variable

I’ve got a php script which connects to the database, then does some non-database stuff for about 20 minutes, then tries to to some database stuff, and gets a ‘mysql server has gone away’.

I’m trying to re-create this on my dev machine to find a workaround, and would like to set a much shorter timeout to make it easier to test. I thought it was the wait_timeout that controlled this, but this (on the production and dev machines) is set to 8 hours. So is it not this that will timeout the idle connection?