donnikitos / vite-plugin-php

Vite's speed and tooling to preprocess PHP-files!
https://www.npmjs.com/package/vite-plugin-php
MIT License
30 stars 0 forks source link

Error loading #12

Closed tristanvann closed 4 months ago

tristanvann commented 5 months ago

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/

donnikitos commented 5 months ago

Can you share your whole usePHP() config?

tristanvann commented 5 months ago

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/

tristanvann commented 5 months ago

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)

donnikitos commented 5 months ago

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

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