donnikitos/vite-plugin-php

Error loading

Closed this issue · 4 comments

When trying to load the base index.php file, I get this PHP error:

Warning: Unknown: Failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Failed opening required '/F:/Git/project/node_modules/vite-plugin-php/dist/router.php' (include_path='.;C:\php\pear') in Unknown on line 0

FWIW, my PHP .exe file is in C:\Program Files\php-8.3.4-Win32-vs16-x64, not C:\php. I've tried putting "binary: C:/Program Files/php-8.3.4-Win32-vs16-x64" in the usePHP() config, but didn't change anything.

I installed the plugin with "npm install vite-plugin-php --save", and the file router.php does exist in /node_modules/vite-plugin-php/dist/

Can you share your whole usePHP() config?

I just made a new project in Vite (vanilla).

vite.config.js:

// vite.config.js
import { defineConfig } from 'vite';
import usePHP from 'vite-plugin-php';

export default defineConfig({
	plugins: [usePHP()],
});

The index.html file renamed to index.php but otherwise untouched. Same error when I go to http://localhost:5173/

I wonder if its this slash at the beginning here:

Fatal error: Failed opening required '/F:/Git/

/F: instead of F:

(I'm doing dev on a windows machine, fyi)

(I'm doing dev on a windows machine, fyi)

Yeah, I noticed. Will need to debug it on Windows and get back to you.