brapifra / vscode-phpserver Goto Github PK
View Code? Open in Web Editor NEWVisual Studio Code extension to quickly serve your PHP projects :)
Visual Studio Code extension to quickly serve your PHP projects :)
When I serve the project I get this url:
http://localhost:3000/Creative
I think it can be fixed by replacing spaces with %20
http://localhost:3000/Creative%20Projects/cp7/php/sidebar.php
OK, with reference to closed issue #40. I have an update:
Using <!--#include virtual="./includes/footer.php" -->
works on the live server (NOT VScode's Live server extension; the actual web server the site is stored on), but it doesn't' work on the localhost using vscode-phpserver extension.
HOWEVER
Using <?php include './includes/footer.php';?>
works on localhost, using the vscode-phpserver, but not on the live server.
To get this to work on both I've added the footer twice, like so:
</section>
</main>
<!--#include virtual="./includes/footer.php" -->
<?php include './includes/footer.php'; ?>
</body>
On viewing the browser source code, the footer is only present once in each case, even though the actual HTML has both includes added, as shown above.
It's probably something to do with my system (Windows 10 Pro Insider), but I haven't a clue what could be causing this behaviour.
TIA
Is it possible to add a setting that when clicked on "Serve project" it would open homepage instead of current file from which PHP server has been initiated? Basically IP+port?
Plus when clicking on "Serve project" icon from top right icons https://monosnap.com/file/Vb57mTO8sLyVj7Gnx9PTuNGfwY2Cen# if the server is running, it could open the browser with new tab instead of simple error message "Server is already running". It's like, I know it does, it could just be simpler to go to browser with server tab open than searching in which tab I have it opened ;o) This could also be controled in settings. Not everyone need this.
Hi, I am not figuring out where to place the settings, I tried user and workspace and no go :) I would need to set a subfolder as root and change the port number. Thanks!
Works fine on the live server but the footer doesn't display on localhost:3000.
<!--#include virtual="./includes/footer.php" -->
Using Version 2.4.4
I am having a bit of trouble trying to get this extension to work. I'm New to coding so please excuse my ignorance. This was working about 4 or 5 months ago, but now I cant seem to figure it out.
I have my paths set as ""phpserver.phpPath": "C:/xampp/php/php.exe",
and "phpserver.relativePath": "C:/xampp/htdocs",
I am not running xampp because I would like to replace it with this tool.
my terminal in vs code shows:
" "PHP Fatal error: Unknown: Failed opening required 'c:\Users********.vscode\extensions\brapifra.phpserver-2.4.6\src\logger.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0"
I don't have a logger.php file in my php folder, pear folder, htdocs, or in the src folder, do I need to create one?
I don't know what a router is but googling suggests a windows startup script I don't think I have any or at least any I set up myself. (It would be nice if the documentation was a bit more clear on where one would typically find such a file or even how a start up script would effect a plugin. Then again I am new so pardon my ignorance.)
I'm using windows 10. I was at one point able to get the error in #42 and #43. I have since uninstalled xampp and vs code, and made sure no configuration files remained. I then reinstalled xampp, vs code and this extension. I do have a new firewall, however I have the server ports set to allow in this range and the firewall itself is on ask to connect and I haven't blocked anything that was obviously this. Any help would be greatly appreciated this tool makes learning so much less tedious! Thank you for your hard work!
Hi friend your extn works well but i have a issue it works only for the first folder in workspace.... For other folders i got "404 not found" and missing characters how to fix it plz
After serving my php page once, that version of the content is all that is ever served.
Installed the plugin and have left it with the default settings. However whenever I select "Serve project with PHP" it opens http://localhost:3000 and I see a page showing:
Not Found
The requested resource / was not found on this server.
Where is it getting the "/" value from? Shouldn't it open the file I have selected in the editor?
I get a white page if I run the server
I'm having error related to time. applications such as wordpress have expired links error.
How can I configure server time?
thanks
Hello again :),
with the last update the console in vscode have no ouput and you cant stop the server with crtl + c (tested with 2 pc´s).
But i like the open browser feature, thanks !
Greetings
the run() is execute in Server's constructor function, but setRouter() is not run at this time
Hi,
whenever I click on "Start Project with PHP" it runs it on index.php and not on a file I want it to run. Is it possible to point it to a different file?
Thanks!
When I click the Server Project with Php Server, the Browser Show me this
404 Not Found
The requested resource / was not found on this server.
this is my PHP DEBUG 's launch.json
{
"name": "Xdebug",
"type": "php",
"request": "launch",
"port": 9000
}
this is my setting.json
"phpserver.browser":"edge",
"phpserver.port":3000
BUT i can use ApacheServer normally , so ,i wanna to know if there is any mistake with my setting.
THANKs!!!
I think that you should be able to choose an alternate to localhost though a config option, with the default being "localhost". That way people can bind to a custom IP or hostname for the machine (like for those who can't alter the hosts file, then they could simply bind to 127.0.0.1 directly).
When I try to start the PHP server i get this error :
ERR_CONNECTION_REFUSED
It executes LOGGER.PHP virus to steal data everytime I run this my anti-virus giving me a notification
If I understood everything right, after serving the project with PHP server, the page should open automatically in a browser with this setting?
How should I do that? I am running VS Code on Mac OS High Sierra.
Thanks
I have a minor request which is annoying me when working with non-php projects and files.
There is always the PHP menus in the right click context menu and the serve project button on the top right. As workaround I modified the package.json to remove the menus. I can still access the PHP commands using the Ctrl+Shift+P menu.
Would it be possible to add an option to hide the context menu options and the button without hacking on the package.json?
On the Occasion : Multi-root Workspaces in Visual Studio Code ,It may not working correctly.Because vscode.workspace.rootPath corresponds to the first entry of workspaceFolders
Core API:
workspace.workspaceFolders access to all WorkspaceFolder (can be undefined when no workspace is opened!)
workspace.onDidChangeWorkspaceFolders be notified when WorkspaceFolder are added or removed
workspace.getWorkspaceFolder(uri)
So,To make it work, we can use workspace.getWorkspaceFolder(uri) to get the root-path instead.
I receive this error:
Server error: Error: spawn php ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Is it any way to solve this ?
Hi there. I tried start the server and it open my browser with localhost:3000 url but then I get a "The connection with localhost was refused. ERR_CONNECTION_REFUSED" on Chrome. Any suggestions what would it be? I'm using the default configs, just changed the "phpserver.browser" to "chrome"
I'm trying to run this on windows but can't get the server to work.
I'm currently learning php and have a small web project in my hard drive. Opened VSCode to work on that project folder, selected one of the project's .php file to edit and used this extension to "start php server".
The message which tells you that the server has started up successfully and project is being served appeared. So far so good, then went into chrome to access this php file and all I see is the content, it's not getting run at all...
Probably I'm missing something really stupid but I can't get what it is :(. It would be good to find a small example on the docs or something like that to get started.
PHP version is 7.0, my OS is Windows 10, and I configured the settings.json to use Chrome as my web-browser with this VS extension. Any help appreciated.
Regards
Can one update the server also on php 7.1 or higher?
Hello,
To put this into context, basically, I would very much like to be able to tie the server, to starting only in Chrome Dev, as I have many other Chrome profiles open, in which I really don't want the server to start it.
In the past I solved this issue by focusing Chrome Dev so that the server would open inside of it upon reloading... however, for some reason currently, the server only opens in the normal version of Chrome, rather than the Dev, despite focusing it before reloading the server... (probably a Chrome Dev/Chrome update that ruined this somehow)
So yeah, could there perhaps be an implementation of an option, that ties the server to a specific Chrome version/browser directory?
Another live server extension, handles this beautifully where one can simply apply:
"liveServer.settings.AdvanceCustomBrowserCmdLine": "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --profile-directory=Profile 8",
Inside of the settings.json of VSCode
Thereby permanently tying a live server to an X browser/version/directory of it, instead of being stuck to something undesirable and largely inconvenient, as per one's custom setup
Kind regards.
Leo
I'm using your extension for work where we write a lot of internal links without the *.php extension (ex: "www.mysite.com/about" as opposed to "www.mysite.com/about.php"), which works on the live server. However, when hosting the site with your PHP server extension locally, it gives me the "file not found" page. Is there a setting that possibly supports this? Any help is greatly appreciated.
Thanks for the extension! Are you able to add in an additional parameter for a router script? (See https://secure.php.net/manual/en/features.commandline.webserver.php , Example 3) I tried to define a file within the relativePath parameter ( "relativePath": "foo .htrouter.php"), but the extension would immediately die everytime I tried to start the server, so for a workaround I have to start the server manually in the terminal instead.
Normally the command would look something similar like this: "php -S localhost:8000 -t foo/ .htrouter.php"
Thanks again.
Hello,
i have an issue when i start the PHPServer in an Zendframework folder.
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
c:\Users\Malte\Desktop\untitled\public>php -S localhost:3000 -t c:\Users\Malte\Desktop\untitled\public/
Directory c:\Users\Malte\Desktop\untitled\public/ does not exist.
c:\Users\Malte\Desktop\untitled\public>
The slash next to public make this error. Can you fix it ?
Hope you get it !
I installed this on mac.
I can start server by typing "Serve Project with PHP" or by clicking "Serve Project with PHP" in popup menu of vs code.
but I can't find "Stop PHP Server" from the Cmd+Shift+P or popup menu of editor.
How can I stop the server so that I can release the used port 3000?
Would like an "Open in browser" option which will open the current php file I'm working on in the current browser with the right url.
For example if I'm working on test.php I want to be able to right click, press "Open in browser", and have the webpage "localhost:3000/test.php" open up in my browser.
@brapifra could you push the latest version(bump to 1.1.0) in this repo to the vscode extension marketplace
so we can have the external binding functionality
i have manually copied the changes that exist on the master to my local extension folder and it works great.
but it would be nice to have the latest changes in the market place..
Cant use mysqli.
"Fatal error: Uncaught Error: Call to undefined function mysqli_connect()"
Theres no php.ini file to import mysqli.
Hola Brais,
The apps Firefox, Firefox Developer and Firefox Nightly have the same command name of 'firefox'. But it opens Firefox instead of Firefox Nightly.
I have already set 'firefox-nightly'
to "phpserver.browser":
, instead of firefox
, but it doesn't open Firefox Nightly because the true command name of this app is 'firefox'.
¿Alguna solución?
¡Gracias!
This is the error im getting:
Server error: Error: spawn php ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19) at onErrorNT (internal/child_process.js:406:16) at process._tickCallback (internal/process/next_tick.js:63:19)
Starts fine but will not shut down on right-click as indicated in your instructions. Only Stop PHP Server command works.
Is there a way to debug php files served by phpserver plugin?
I have XDebug installed and set, php-debug extension in VSCode seems to be working too (when php file is run from the command line the breakpoints work), however when php code is run by phpserver, breakpoints do not break.
Are there some settings I am missing?
Thanks
The Serve Project command opened the browser before it had finished parsing my project and the browser was unable to connect. It took 15/20ish seconds to finish parsing the project. I didn't realize it was still parsing the files & thought the server had stopped working. Maybe it should wait to open the browser until the whole project has been parsed?
I have a project that i am maintaining and it is trying to processing html files as php files.
using the following line in the .htaccess file.
AddType application/x-httpd-php .html
If i set it up through apache it will work fine but when running through phpserver it treats it as an html file. Am i missing something?
how can i change server port to 3000 to 8080?
Heya, I ran into an issue where the server is still running even though I uninstalled it.
I reinstalled PHP Server to stop it from serving files and it's somehow still able to serve the pages.
Server error: Error: spawn php ENOENT at _errnoException (util.js:1024:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19) at onErrorNT (internal/child_process.js:372:16) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)
Running on macOS, server stoped when I open the chrome developer tools for Inspecting CSS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.