Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

joshuapphillips's avatar

Call to undefined function Livewire\tmpfile()

I have moved my app from my local machine to a server and I am getting this error when trying to upload a file. The app still works fine on my local machine.

How do I resolve this?

This is the code that accompanies up with the warning.

| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*

|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|

*/
$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
    $request = Request::capture() 
)->send();

$kernel->terminate($request, $response);

$request = Request::capture() is highlighted.

The error in the laravel.log file says

production.ERROR: Call to undefined function Livewire\tmpfile() {"userId":1,"exception":"[object] (Error(code: 0): Call to undefined function Livewire\tmpfile() at /home/user-name/webapps/app-name/vendor/livewire/livewire/src/TemporaryUploadedFile.php:22)

0 likes
10 replies
Sinnbeck's avatar

You should also get a stack trace where you can see which of your files the error originates from

joshuapphillips's avatar

@click Hi, Yes that is the line it is failing on.

No i am not on shared hosting.

I'll look into why tmpfile() could be disabled.

Sinnbeck's avatar

@shabeer The solution is already mentioned in the post by @click ? Make sure the tmpfile method isnt disabled on your server

1 like
joshuapphillips's avatar

@shabeer tmpfile() was set as a disabled function by default on our server. We are using Runcloud so it just required the settings updating.

2 likes

Please or to participate in this conversation.