<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Compiles and caches a PHP script without executing it</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.opcache.html">OPcache Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.opcache-get-configuration.html">opcache_get_configuration</a></div> <div class="up"><a href="ref.opcache.html">OPcache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.opcache-compile-file" class="refentry"> <div class="refnamediv"> <h1 class="refname">opcache_compile_file</h1> <p class="verinfo">(PHP 5 >= 5.5.5, PECL ZendOpcache > 7.0.2)</p><p class="refpurpose"><span class="refname">opcache_compile_file</span> — <span class="dc-title">Compiles and caches a PHP script without executing it</span></p> </div> <div class="refsect1 description" id="refsect1-function.opcache-compile-file-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">boolean</span> <span class="methodname"><strong>opcache_compile_file</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$file</code></span> )</div> <p class="para rdfs-comment"> This function compiles a PHP script and adds it to the opcode cache without executing it. This can be used to prime the cache after a Web server restart by pre-caching files that will be included in later requests. </p> </div> <div class="refsect1 parameters" id="refsect1-function.opcache-compile-file-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">file</code></em></span> <dd> <p class="para"> The path to the PHP script to be compiled. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.opcache-compile-file-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> if <em><code class="parameter">file</code></em> was compiled successfully or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 errors" id="refsect1-function.opcache-compile-file-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> If <em><code class="parameter">file</code></em> cannot be loaded or compiled, an error of level <strong><code>E_WARNING</code></strong> is generated. You may use <a href="language.operators.errorcontrol.html" class="link">@</a> to suppress this warning. </p> </div> <div class="refsect1 seealso" id="refsect1-function.opcache-compile-file-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.opcache-invalidate.html" class="function" rel="rdfs-seeAlso">opcache_invalidate()</a> - Invalidates a cached script</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.opcache.html">OPcache Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.opcache-get-configuration.html">opcache_get_configuration</a></div> <div class="up"><a href="ref.opcache.html">OPcache Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>