Coder Social home page Coder Social logo

Comments (8)

brapifra avatar brapifra commented on May 29, 2024 1

Hi @NickBerkson

The problem is that you are using an absolute path in phpserver.relativePath.
You should be able to make it work by removing the phpserver.relativePath configuration and opening the C:/xampp/htdocs folder with VScode (File -> Open Folder...).

from vscode-phpserver.

NickBerkson avatar NickBerkson commented on May 29, 2024

Ah, thank you!

I ended up deleting both settings, then I created a global environment variable for my PC to point at the php location. Seems to work. Hope I don't reinstall xampp and forget that's what I did at some point.

from vscode-phpserver.

NickBerkson avatar NickBerkson commented on May 29, 2024

And its broken again...

Fatal e
rror: Unknown: Failed opening required 'c:\Users*******.vscode\extens
ions\brapifra.phpserver-2.4.6\src\logger.php' (include_path
='C:\xampp\php\pear') in Unknown on line 0

I've cleared all my settings so "phpserver.phpPath": "C:/xampp/php/php.exe" is the only setting in my .json file.

I've tried opening the folder with vscode (File -> Open Folder...) in htdocs and elsewhere

I then tried adding :
"php.validate.enable": true,
"php.executablePath": "C:\xampp\php\php.exe",
"php.validate.executablePath": "C:\xampp\php\php.exe",
I then removed those settings.

I also tried :
"phpserver.phpPath": "C:\xampp\php\php.exe",
"phpserver.phpPath": "C:/xampp/php/php.exe",

For my global windows path variable I tried :
C:\xampp\php;
then I tried changing it to :
C:\xampp\php\php.exe

I even edited my php.ini so it would say include_path = C:\xampp\php\pear

At this point I'm unsure what else to try. I feel dumb that I can't figure this out...

from vscode-phpserver.

blachawk avatar blachawk commented on May 29, 2024

I'm running into a similar situation. After setting my open_basedir in my php.ini file for testing purposes. The error I am receiving is:

Fatal error: Unknown: Failed opening required 'c:\Users\...\.vscode\extensions\brapifra.phpserver-2.4.6\src\logger.php' (include_path='.;C:\php\pear') in Unknown on line 0

Where can i go to remove C:\php\pear. That's not even a real directory on my machine. I looked under my environmental variables in my WIndows 10 machine. That folder is not in path. Where else would it be? Hard-coded inside the extension itself?

Many Thanks!

from vscode-phpserver.

caiohamamura avatar caiohamamura commented on May 29, 2024

That's really strange, here in my machine the logger.php is located in .vscode\extensions\brapifra.phpserver-3.0.2\src\server\logger.php inside the server directory.

I found someone with the same problem, I'll check if I can help her to fix that. There's also this issue posted in https://superuser.com/questions/1646540/php-error-with-logger-php-unknown-failed-to-open-stream-no-such-file-or-di which suggests creating/editing the logger.php to match the content:

<?php
$path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$relativePath = getenv('PHP_SERVER_RELATIVE_PATH');
$fullPath = $_SERVER["DOCUMENT_ROOT"] . $relativePath . $path;
if (!file_exists($fullPath) || is_dir($fullPath)) {
    file_put_contents("php://stderr", sprintf("[%s] %s", date("D M j H:i:s Y"), "[404] $path - No such file or directory "));
}
else {
    file_put_contents("php://stdout", sprintf("[%s] %s", date("D M j H:i:s Y"), "[200] $path"));
}
return false;
?>

from vscode-phpserver.

caiohamamura avatar caiohamamura commented on May 29, 2024

I've figured it out what was happening in this girl's machine, the Avast Antivirus was blocking logger.php and quarantined it, check if your antivirus isn't doing the same.

from vscode-phpserver.

Elyas-GO avatar Elyas-GO commented on May 29, 2024

tnx caiohamamura
restore server.php from avast antivirus quarantine work for me.
the error that i face when browsing 127.0.0.1:8000 is
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

from vscode-phpserver.

Bimaajisatria avatar Bimaajisatria commented on May 29, 2024

gak iso bolo

from vscode-phpserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.