note 113162 added to function.exec

From: Date: Fri, 06 Sep 2013 15:03:30 +0000
Subject: note 113162 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-196187@lists.php.net to get a copy of this message
I just tried the following: exec('cp "/MySite/web/uploads/' .$matches[1][0]. '/startupvids/mp4/'. substr($fileonly,0,strlen($fileonly)-4) .'.mp4" "/MySite/web/uploads/newfolder/'.$video->getSiteId().'-'.substr($fileonly,0,strlen($fileonly)-4).'.mp4"'); I think exec has an issue with the amount of php commands within the exec - the above doesn't work. To get around this issue put everything into variables before hand so you end up with: $location1 = "/MySite/web/uploads/' .$matches[1][0]. '/startupvids/mp4/'. substr($fileonly,0,strlen($fileonly)-4) .'.mp4"; $location2 = "/MySite/web/uploads/startupvids/mp4/'.$video->getSiteId().'-'.substr($fileonly,0,strlen($fileonly)-4).'.mp4"'; exec('cp '.$location1 .' ' .$location2); ---- Server IP: 69.147.83.199 Probable Submitter: 62.133.3.21 ---- Manual Page -- http://php.net/manual/en/function.exec.php Edit -- https://master.php.net/note/edit/113162 Del: integrated -- https://master.php.net/note/delete/113162/integrated Del: useless -- https://master.php.net/note/delete/113162/useless Del: bad code -- https://master.php.net/note/delete/113162/bad+code Del: spam -- https://master.php.net/note/delete/113162/spam Del: non-english -- https://master.php.net/note/delete/113162/non-english Del: in docs -- https://master.php.net/note/delete/113162/in+docs Del: other reasons-- https://master.php.net/note/delete/113162 Reject -- https://master.php.net/note/reject/113162 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#196187) next »