atom / ide-php

PHP language support for Atom-IDE
MIT License
264 stars 41 forks source link

Outline won't show... ErrorException: stream_socket_client(): unable to connect to tcp://127.0.0.1:xxxxx #97

Closed intersel closed 6 years ago

intersel commented 6 years ago

Hi,

My environment is:

I stopped my kaspersky antivirus and windows defender firewall.

I've got this error when starting atom:


HP (FelixFBecker) starting "C:\wamp\bin\php\php7.1.13\php.exe felixfbecker\language-server\bin\php-language-server.php --memory-limit=2G --tcp=127.0.0.1:54201"
C:\Users\Emmanuel\.atom\packages\ide-php\node_modules\atom-languageclient\build\lib\logger.js:15 PHP (FelixFBecker) stderr ErrorException: stream_socket_client(): unable to connect to tcp://127.0.0.1:54201 (Une tentative d�acc�s � un socket de mani�re interdite par ses autorisations d�acc�s a �t� tent�e.
) in C:\Users\Emmanuel\.atom\packages\ide-php\vendor\felixfbecker\language-server\bin\php-language-server.php:40
Stack trace:
#0 [internal function]: {closure}(2, 'stream_socket_c...', 'C:\\Users\\Emmanu...', 40, Array)
#1 C:\Users\Emmanuel\.atom\packages\ide-php\vendor\felixfbecker\language-server\bin\php-language-server.php(40): stream_socket_client('tcp://127.0.0.1...', 10013, 'Une tentative d...')
#2 {main}
warn @ C:\Users\Emmanuel\.atom\packages\ide-php\node_modules\atom-languageclient\build\lib\logger.js:15
C:\Users\Emmanuel\.atom\packages\ide-php\node_modules\atom-languageclient\build\lib\logger.js:27 PHP (FelixFBecker) exited code 0

As there is no firewall... what am I missing to fix this problem?

damieng commented 6 years ago

You could try changing the settings for ide-php so that it uses stdio instead.

I don't know why it wouldn't be connecting otherwise. Is working fine here on Windows 10.

intersel commented 6 years ago

I did it and somewhat it's better as there is no more errors in the console... I did not see the option... thanks!

But I always have the outline pane that has the loader picto running... but nothing is displayed... just the loader rotating on itself forever...

rsese commented 6 years ago

But I always have the outline pane that has the loader picto running... but nothing is displayed... just the loader rotating on itself forever...

If you enable debugging by running atom.config.set('core.debugLSP', true); in devtools console and then reload Atom, can you share the log output when you toggle the outline view?

Also, can you share a simple example file where you see this behavior?

intersel commented 6 years ago

Here the output I've got:

<embedded>:121059 IntersectionObserver.observe(target): target element is not a descendant of root.
TreeView @ <embedded>:121059
C:\Users\Emmanuel\.atom\packages\ide-css\node_modules\atom-languageclient\build\lib\logger.js:27 PHP (FelixFBecker) Server starting "C:\wamp64\www\apidev.qwid.me\"
C:\Users\Emmanuel\.atom\packages\sync-settings\lib\sync-settings.coffee:93 checking latest backup...
C:\Users\Emmanuel\.atom\packages\sync-settings\lib\sync-settings.coffee:392 Creating GitHubApi client with token = 43da8a36cf56a1e01aee1c197d2a7ecdece208c6
C:\Users\Emmanuel\.atom\packages\ide-css\node_modules\atom-languageclient\build\lib\logger.js:27 PHP (FelixFBecker) Using PHP 7.1.13 from C:\wamp64\bin\php\php7.1.13\php.exe
C:\Users\Emmanuel\.atom\packages\ide-css\node_modules\atom-languageclient\build\lib\logger.js:27 PHP (FelixFBecker) starting "C:\wamp64\bin\php\php7.1.13\php.exe felixfbecker\language-server\bin\php-language-server.php --memory-limit=2G"
C:\Users\Emmanuel\.atom\packages\ide-css\node_modules\atom-languageclient\build\lib\logger.js:27 PHP (FelixFBecker) rpc.sendRequest initialize sending Object
C:\Users\Emmanuel\.atom\packages\sync-settings\lib\sync-settings.coffee:118 latest backup version 5b6e433cf0274f2f8b37f0e4f68c8203a5544075

Here a php file as example (none of my php files work)

<?php
//print_r($_REQUEST);exit;
/*
 * This file is part of MODX Revolution.
 *
 * Copyright (c) MODX, LLC. All Rights Reserved.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

$tstart= microtime(true);

/* define this as true in another entry file, then include this file to simply access the API
 * without executing the MODX request handler */
if (!defined('MODX_API_MODE')) {
    define('MODX_API_MODE', false);
}

/* this can be used to disable caching in MODX absolutely */
$modx_cache_disabled= false;

/* include custom core config and define core path */
@include(dirname(__FILE__) . '/config.core.php');
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/');

/* include the modX class */
if (!@include_once (MODX_CORE_PATH . "model/modx/modx.class.php")) {
    $errorMessage = 'Site temporarily unavailable';
    @include(MODX_CORE_PATH . 'error/unavailable.include.php');
    header('HTTP/1.1 503 Service Unavailable');
    echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
    exit();
}

/* start output buffering */
ob_start();

/* Create an instance of the modX class */
$modx= new modX();
if (!is_object($modx) || !($modx instanceof modX)) {
    ob_get_level() && @ob_end_flush();
    $errorMessage = '<a href="setup/">MODX not installed. Install now?</a>';
    @include(MODX_CORE_PATH . 'error/unavailable.include.php');
    header('HTTP/1.1 503 Service Unavailable');
    echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p></body></html>";
    exit();
}

/* Set the actual start time */
$modx->startTime= $tstart;

/* Initialize the default 'web' context */
$modx->initialize('web');

/* execute the request handler */
if (!MODX_API_MODE) {
    $modx->handleRequest();
}
rsese commented 6 years ago

I tried your test file and the outline view worked for me on Windows 10. I wasn't having any trouble connecting though so my connection setting for the package was still set to auto. I switched to stdio and saw the same thing as you - the log output stops at "rpc.sendRequest initialize sending Object" and doesn't get any further (e.g. there's no log output when I toggle the outline view).

intersel commented 6 years ago

Well, I tried with sockets... with stdio... re-verify that there is no firewall... nothing works and I don't know what to do to help to sort this out :-(

damieng commented 6 years ago

@intersel Are you on a corporate or university machine? I'm having trouble trying to figure out why it wouldn't be able to connect to itself over a local network socket other than some aggressive security controls.

intersel commented 6 years ago

I'm not on a corporate or university machine or network... I deactivated the windows defender that was still active... I set the directory of atom in the exclusion list for the "windows defender"... I started atom in admin mode I updated all the packages of atom... I set back the ide-php connection type to automatic.... and... miracle... it worked... I need to investigate a little more to understand what is blocking the feature... as I set back the windows defender active and it still works... Is it only to having add the atom program in the exclusion list of windows defender...? perhaps yes...

intersel commented 6 years ago

But with kaspersky on, I can't succeed to have it worked... can't see what parameters, exe or dir I'm missing to exclude...

damieng commented 6 years ago

I'm not familiar with Kapersky but I'd recommend excluding the .atom\packages\ide-php folder in your home directory. A sub-directory there contains the language server. If that doesn't work you might have to exclude wherever your php installation is depending on how Kapersky determines what to block.

intersel commented 6 years ago

I did that... but it still was not working... I simply update my kaspersky version 2017 to the last one 2018... and... everything runs now smoothly... Thanks for your support....