cron job that kills a process after 5 hours
You can do this with timeout (coreutils):
30 23 * * * timeout 18000 /usr/bin/php /var/www/ul/prices_all.php >> /var/www/ul/log/prices_all.txt
It simply sets a timeout (18000secs = 5 hours) and kills the process if it is still running after that time.
Or you can set a timeout in the php file itself:
<?php set_time_limit(18000);