GAE dev_appserver crashes CGI / FastCGI on windows - php

I installed python 2.7 and the Goole Cloud SDK.
After that I installed the php runtime using this command :
gcloud components install app-engine-php-windows
I then boot up a local dev server using this line :
dev_appserver.py <app-directory>
The server boots up fine, but when I send multiple requests to the server, I see multiple popups (one after te other) saying "CGI / FastCGI has stopped working". I can then "Debug" or "Close program".
In the logfile I see this :
ERROR:root:php failure (255) with:
stdout:
ERROR:root:php failure (-1073741819) with:
stdout:
OS specifics : Windows 10 Pro 64-bit.
Also, adding extension="php_curl.dll" to php.ini does not avoid my problem as stated in other issues similar to this one.
Can anyone help with this issue?

Related

Remote PHP Debugging from within WSL2 in Visual Studio Code

I'm running Windows 10, with a WSL2 Ubuntu instance. I do my development within the WSL2 instance with the "Remote - WSL" extension of Visual Studio Code. So my VSC is running as a WSL2 application, not as a Windows application. I have an additional remote server (I'll refer to this as "Server X" which actually hosts/runs the PHP code. This remote server does not support the use of the "Remote - WSL" extension, so I use an "SFTP" extension to push my changes to this server. And I cannot run the code locally (in either Windows or WSL2) due to the database connection being unsupported.
I'm trying to configure remote debugging of the code on Server X from within VSC running as a WSL2 application (IE: using the "Remote - WSL" extension). The intent is to listen for a browser request to initiate the debug session.
What's happening is when I turn on "Listen for Remote Connection" in VSC when running as a WSL2 application, it doesn't detect the browser when I refresh it. I've determined the reason is because while running as a WSL2 application, my IP is different than when I'm outside WSL (which is where I'm refreshing the browser). So in short, I'm initiating a browser session outside of WSL (IP: 192.168.1.2), the remote server attempts to connect to a debugger at 192.168.1.2:9003, but doesn't find one because my VSC is listening on 192.168.1.3:9003 while it's running as a WSL2 application.
I've confirmed if I instead run VSC as a Windows application (IE: not using Remote - WSL extension on WSL2 instance) everything works fine after adjusting some setting paths to point to Windows PHP rather than WSL2 PHP.
I've been trying to play around with using SSH tunnels to re-route my port 443 traffic from Windows through WSL, but have been unsuccessful so far.
Has anyone run into this issue and have any idea how to get around it? Or is what I'm trying to do unsupported/discouraged?
So WSL runs under the 172.16. 0.0/12 private address range and is not directly accessible by anything external to the host Windows machine. As such, populating xdebug.client_host with this IP, will not work.
My initial idea of using port forwarding was correct, but not in the direction I thought. Instead of redirecting the outgoing web traffic (443 since my site is using SSL) from Windows through WSL, then redirect from WSL to Server X. I instead just needed to redirect the incoming xdebug traffic (9003) from Windows to WSL. (Probably what #Derick was alluding to)
To do this, I left xdebug configured as it normally would have been if WSL wasn't in the picture.
So:
zend_extension=xdebug
xdebug.mode=profile,debug
xdebug.idekey=<ide key value here>
xdebug.client_host=<ip of windows host, as backup>
xdebug.start_with_request=trigger
xdebug.trigger_value=<my trigger value>
xdebug.discover_client_host = 1
Then, using the following PowerShell script on the Windows host to redirect port 9003 from the Windows host to the WSL guest:
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if ($found) {
$remoteport = $matches[0];
}
else {
Write-Output "IP address could not be found";
exit;
}
$ports = #(9003);
for ($i = 0; $i -lt $ports.length; $i++) {
$port = $ports[$i];
Invoke-Expression "netsh interface portproxy delete v4tov4 listenport=$port";
Invoke-Expression "netsh advfirewall firewall delete rule name=$port";
Invoke-Expression "netsh interface portproxy add v4tov4 listenport=$port connectport=$port connectaddress=$remoteport";
Invoke-Expression "netsh advfirewall firewall add rule name=$port dir=in action=allow protocol=TCP localport=$port";
}
Invoke-Expression "netsh interface portproxy show v4tov4";
Above script is modified from the script found here:(https://dev.to/vishnumohanrk/wsl-port-forwarding-2e22)
Which itself is modified from here: (https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723)
Note*: You have to install net-tools in the WSL guest in order for the above script to work, so: sudo apt install net-tools.

Xdebug Problems with Eclipse PHP/PDT

I am having some difficulty using PHP Xdebug with the PHP's internal server provided by later releases of Eclipse. I am running Eclipse for PHP Developers Version: Oxygen.3a Release (4.7.3a). Interestingly enough Xdebug is working quite well with Apache 2, but not the internal PHP server.
Note that the PHP internal server is running. I can use ‘Run As – 1Run on Server’ to run a phpinfo PHP script and a helloworld PHP script. In these cases, the PHP internal server is started with the expected operands. The Linux ps command returns:
/usr/bin/php -S 127.0.0.1:8000 -t /home/peter/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/htdocs
Note that port 8000 is used to start the internal PHP server (correctly as best I can tell) and no –n operand is specified. This causes the /etc/php/7.0/cli/php.ini file to be processed (correctly as best I can tell).
Note that port 80 was originally used to run this server. Of course, port 80 is restricted to root applications. The change to port 8000 was required to get the internal PHP server to start at all.
Also note that checking ‘Use system default php.ini configuration’ and clearing the PHP ini file (optional) field in the PHP Executable preferences was required to get rid of the –n operand.
Also note that I am having some difficulty switching between ‘Run As’ and ‘Debug As’. In some cases I get a message showing that the required port (8000) is already in use. However, I have not found a way to reproduce this problem so far.
Using the procedures described above, the debug internal PHP server was started without the –n operand and is processing the php.cli file. The Linux ps command returns:
/usr/bin/php -S 127.0.0.1:17278 -t /home/peter/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/htdocs
One question is why port 17278 was specified, rather then the expected port (8000). Running phpinfo() shows that Xdebug appears to be installed in the debug internal web server. A few settings include:
xdebug support – enabled
IDE Key – peter (my userid on this machine)
DBGp – Common DeBuGger Protocol - $Revision: 1.145 $
xdebug.remote.enable – on
xdebug.remote.port – 9000
I tried to debug helloworld.php. The console has the following two messages. The first shows a 404 code. The second shows a 200 code:
[Sun Apr 22 17:36:20 2018] 127.0.0.1:50358 [404]: /?start_debug=1&debug_fastfile=1&use_remote=1&ZRayDisable=1&send_sess_end=1
&debug_session_id=1003&debug_start_session=1&debug_port=10137 - No such file or directory
[Sun Apr 22 17:36:20 2018] 127.0.0.1:50362 [200]: /Server-docroou/helloworld.php?start_debug=1&debug_fastfile=1&use_remote=1&ZRayDisable=1&send_sess_end=1
&debug_session_id=1003&debug_start_session=1&debug_port=10137
Note that the debug port is specified as 10137. Perhaps this is causing the problem. Port 10137 is normally used by the Zend Debugger which I am not using.
Does anyone have any ideas? Thank you in advance.
Problem fixed in PDT 6.0 : https://bugs.eclipse.org/bugs/show_bug.cgi?id=533928 ;)

Unable to start xampp on mac os sierra?

I have installed xampp on my mac os sierra.Now when i try start the server it shows me some error.It does not start.I have tried restarting & reinstalling the server but still i am facing the issue.
failed to start machine: hyperkit: [ERROR] Found a reference to cluster 19715 outside the file (max cluster 19711) from cluster 4.2165
hyperkit: [ERROR] Mirage block device raised exception: Qcow.Make(Base)(Time).Reference_outside_file(_, _)
Mirage-block error: Block device is disconnected
Could not open mirage-block device: Invalid argument
Could not open backing file: Invalid argument
I am not able to find any solution. Please suggest what should i do ?
Although i could not fix this particular error with xammpp software.This xampp software was XAMPP-VM / PHP 7.1.7.So i deleted this software from my machine and downloaded another version of xampp which is 7.1.7 / PHP 7.1.7.Actually there are 4 software listed on the xampp website earlier i download the VM version of xampp.But after intsalling another version of XAMPP solved my problem.

unable to use dev_appserver.py to run the local development server on mac

I was following the tutorial on Google cloud platform to run the local server for the hello-world app, and using the dev_appserver.py command, however, the terminal complain with the message as below:
$ dev_appserver.py .
INFO 2016-10-22 21:59:53,084 devappserver2.py:769] Skipping SDK update check.
INFO 2016-10-22 21:59:53,129 api_server.py:205] Starting API server at: http://localhost:56857
INFO 2016-10-22 21:59:53,133 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2016-10-22 21:59:53,137 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR 2016-10-22 21:59:54,141 php_runtime.py:348] The PHP runtime is not available
Traceback (most recent call last):
File "/Users/Dale/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path)
File "/Users/Dale/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 265, in _check_binaries
raise _PHPBinaryError('The development server must be started with the '
_PHPBinaryError: The development server must be started with the --php_executable_path flag set to the path of the php-cgi binary.
what does the complain mean? Is there anything wrong with the php_runtime.py? and how can i set it straight? Thank you so much.
If you're on a Mac, you need to run this command:
gcloud components install app-engine-php-darwin
If you're on Linux, you need to provide --php_executable_path as the error message states.

PHPUnit Selenium Xvfb Centos

I am trying to setup functional tests on my Centos Server using Selenium Web Server and Phpunit.
When I run the tests, I get an error in the command line :
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host vmdev-pando-56 on port 7055 after 45000 ms.
Firefox console output: Error: no display specified
I've been doing research for more than three days and I couldn't find a solution. I read many posts, including SOverflow. As per my understanding, everything is properly set up, and yet I am experiencing the same problem as many other people, and the solutions that work for them seem to be not working for me.
This is my setup:
OS: Centos 6.5 x86 in command line (no GUI)
PHP: 5.6
Phpunit: 3.7, although I also tried with 5.3
Selenium standalone web server: 2.53, downloaded from here, although I also tried with 2.9
Xvfb system: xorg-x11-server-Xvfb
Firefox: 38.0.1, although I also tried with 38.7
I also set the DISPLAY to :99 in my bash profile:
This is what I do to set up the environment:
First, I launch the Xvfb system: /usr/bin/Xvfb :99 -ac -screen 0 1280x1024x24 &
Then I launch the Selenium server: /usr/bin/java -jar /usr/lib/selenium/selenium-server-standalone-2.53.0.jar &
I launch Firefox: firefox & (although I know this is not necessary, but just in case)
All of the three processes are running in background.
At this point, I know that Firefox is operative, as well as the X buffer. I can run the command firefox http://www.stackoverflow.com & and then take an snapshot of the buffer by executing import -window root /tmp/buffer_snapshot.png, which happens to be something like this:
I of course received a warning on the terminal: Xlib: extension "RANDR" missing on display ":99", but I read countless of times that this is not a problem.
Anyway, the problem begins just now.
I've written a rather simple functional test (please notice that other tests I've written other than functional, they work just fine, so the environment in that respect seem to be properly configured):
<?php
namespace My\APP\BUNDLE\Tests\Functional\MyTest;
use PHPUnit_Extensions_Selenium2TestCase;
class HelloWorldTest extends PHPUnit_Extensions_Selenium2TestCase {
protected function setUp() {
$this->setBrowser('firefox');
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowserUrl('http://www.stackoverflow.com');
}
public function testTitle() {
$this->url('/');
$this->assertEquals("1", "1");
}
}
And when I run the test by issuing phpunit HelloWorldTest.php, I get the following error:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException:
Unable to connect to host vmdev-pando-56 on port 7055
after 45000 ms. Firefox console output:
Error: no display specified
Checking the log file generated by selenium, I found the following (interesting) lines:
21:55:46.135 INFO - Creating a new session for Capabilities [{browserName=firefox}]
[...]
java.util.concurrent.ExecutionException:
org.openqa.selenium.WebDriverException:
java.lang.reflect.InvocationTargetException
Build info: version: '2.53.0',
revision: '35ae25b',
time: '2016-03-15 17:00:58'
System info: host: 'vmdev-pando-56',
ip: '127.0.0.1',
os.name: 'Linux',
os.arch: 'i386',
os.version: '2.6.32-431.el6.i686',
java.version: '1.7.0_99'
Driver info: driver.version: unknown
[...]
(The file contains the complete stack trace dump, and the original message of no display specified)
No errors in the Xvfb log file.
At this point I have no clue of what I am doing wrong.
Can anyone help?
Thanks a lot
A reason for the Unable to connect error is that the version of Selenium Server does not know how to work with the version of Firefox you have installed. Selenium standalone web server 2.53 is the latest and greatest. selenium-firefox-driver is also 2.53. Firefox version 38 is old. I am running firefox 45.0.1 with selenium 2.53.

Categories