title: How to create MySQL stored procedures from PHP?
body: <p>I wrote a database migration PHP script, that loops a list of SQL files and executes their content. It should help to automate the project setupd and updates. Now I'm getting errors like this:</p>
  
  <pre><code>mapCoursesToSport.sql: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER |
  DROP PROCEDURE IF EXISTS mapCoursesToSport|
  CREATE PROCEDURE mapCo' at line 1
  </code></pre>
  
  <p>I was getting the same error when I was passing to the script a file with a view definition, that also was using <code>DELIMITER</code>s. Then I found the workaround just to remove the delimiters from the SQL file. And it worked. But now it's not an option, since stored procedures really need delimiter definitions.</p>
  
  <p>So, how can I define MySQL stored procedures from PHP? (Or maybe morre generally: How should this <code>SDELIMITER</code> be handeled?)</p>