android avd connect to localhost php Lumen Port 8000 - php

I have installed php-Server:
https://windows.php.net/download/
Then I built the Lumen based Webserver with this Link:
https://computerhalbwissen.de/wie-man-mit-dem-lumen-framework-eine-rest-api-erstellt/
I can now go to the following path:
cd C:\php\lumen-api
Then I typed in this line:
php -S localhost:8000 -t public
And I easily got my json-String with this line, when I typed it in
the browser address line:
http://localhost:8000/api/items/
I did a GET request in the browser of my android avd:
10.0.2.2:8000/api/items/
I get following screen:
What do I have to do to avoid this response. Do I have to
set something in the configurations of my avd?
Thank you for your help.

I cant access the php-Server with my Android-Device.
I installed xampp and everything works fine.

Related

php artisan serve working but URL not working

I installed xampp and laravel in my system and while connecting my project in command prompt it shows as "Development Server (http://127.0.0.1:8080) started", whereas it is not launching the browser and I manually copy the link to the browser and it is not working and getting the below error. Please help me
enter image description here
Your screenshot shows that you're trying to connect to a different port (8000 vs 8080). Try http://127.0.0.1:8080 or http://localhost:8080.

$_GET["_url"] on Apache2 Webserver not working

I am currently working on a REST API in PHP. Therefore I set up XAMPP on my Windows 10 PC and so far it is working as intended.
To access a REST-Endpoint I would have to open https://<PC IP>/Api/ExampleEndpoint. Now ExampleEndpoint is saved in the Variable $_GET["_url"] and i can see the Content of that Endpoint in my Browser.
Now i tried the same on an Apache2 Webserver on my Raspberry PI, but when accessing the same Endpoint in the Browser (https://<RASP-IP>/Api/ExampleEndpoint) i get an 404 Not Found - The requested URL /Api/server was not found on this server. If i explicitly provide the Parameter as a GET Variable in the URL (https://<RASP-IP>/Api?_url=ExampleEndpoint) it works as intended.
Is there a possibility to use the same URL Syntax as it worked for XAMPP on Windows?
PC: Win10, XAMPP, PHP7.3.3
Raspberry PI: Debian Stretch, Apache2 Webserver, PHP 7.0.33-0+deb9u3

Laravel angularJS local host cannot be accesed from another computer inside my network

I have a proyect that is working on my main machine. I use the php -S localhost:8080 -t public command to start a local server. It works perfectly. But now I want to access it from another computer inside my own network but it does not work. In my other computer I type the ip address of the computer with the php server running like this 192.168.1.135:8080, but it does not connect. It just gives me timed out error. Any ideas on how to make this work?
I figured it out. Instead of localhost:8080, I changed it to 0.0.0.0:8080. That did the trick.

command working in cmd but not through php shell_exec

I have a command in cmd which looks like below
C:\wamp\www\editor\DocTo-master\exe\docto -f C:\wamp\www\editor\uploaded\uploaded_files_21_original\AffidavitinDIR-4.docx -O "C:\wamp\www\editor\uploaded\uploaded_files_21_original\pdf\21.pdf" -T wdFormatPDF
When I run this in cmd, it works absolutely fine and gives output(doc to pdf) as expected.
However when I put the same command in php shell_exec like
shell_exec('C:\wamp\www\editor\DocTo-master\exe\docto -f C:\wamp\www\editor\uploaded\uploaded_files_21_original\AffidavitinDIR-4.docx -O "C:\wamp\www\editor\uploaded\uploaded_files_21_original\pdf\21.pdf" -T wdFormatPDF');
I dont get the desired output with the above code in php.
Any help will be appreciated
Seems like most of the problems have to do with permissions or redirection.
Your current user credentials allow you to create files in that directory but does the webserver username?
Redirect stderr to stdout to get error information.
Is the quoting right?
Look in the webserver error logs.
I am the author of docto.
This is most probably a permissions issue in that php is not necessarily given the correct permissions to run word on your server.
I am running this myself on a Windows 2012 server running Word 2010, it works fine. DocTo is installed on a subdirectory above the Webserver root.
PHP is running as NTSystem Authority
Also I am using exec rather than shell_exec not sure if that makes any differnce
For fix this problem you must create Desktop folder in these paths:
C:\Windows\SysWOW64\config\systemprofile\Desktop
C:\Windows\System32\config\systemprofile\Desktop
Then go to (Control Panel\Administrative Tools\Services) and right click on your apache service. go to "Log On" tab and enable "Allow service to interact with desktop" option.
Then reset your apache service.
http://pmlearning.info

Running Google App Engine PHP on Windows

I keep getting Syntax Error: unexpected character after line continuation character when I try to start the localhost server with the following command:
google_appengine\dev_appserver.py --php_executable_path="C:\Computer Science\PHP\php\php-cgi.exe" "C:\Computer Science\PHP\helloworld"
What's wrong?
My app.yaml:
application: helloworld
version: 1
runtime: php
api_version: 1
handlers:
- url: /.*
script: helloworld.php
My helloworld.py
<?php
echo 'Hello, World!';
?>
My directories
/PHP
/php
/php-cgi.exe
/helloworld
/google_appengine
Edit:
I have ran my app using the google app engine launcher, with php sdk and an extra command line flag in the launch settings:
--php_executable_path=C:\Computer Science\PHP\php\php-cgi.exe. The server crashed.
user2481064 use the windows CMD, make sure you're in the same path as your google app engine sdk, i basically put my GAE SDK and application in the same path. Here it is:
Open your windows cmd, make sure you're in the same directory as your sdk.
Type: "google_appengine/dev_appserver.py" --port=9999 --php_executable_path="fullpath\php-cgi.exe" "helloworld/"
If you have another local server like xampp or wamp,make sure you use the --port command to select another listening port as shown above.
4.Press enter and you should have your helloworld script working.
Good luck :)
I too got stuck with this or the other error "SyntaxError: can't assign to operator". Things got better when I stoppped using the Python shell but use the Windows cmd shell.
For my environment, the command I arrive at is
"google_appengine\dev_appserver.py" --php_executable_path="\BitNami\rubystack-1.9.3-10\php\php-cgi.exe" "helloworld/"
(The direction of some of the slashes can be important if you later use parts of the command for separate investigation/diagnose in Windows.) Wow the engine starts despite various errors. At the webbrowser, I was able to see the localhost equivalent of the dashboard at localhost:8000/instances (force-redirected from localhost:8000) BUT the app itself at localhost:8080 (that's 8080) just shows
' "BitNami/rubystack-1.9.3-10/apache2/cgi-bin/php-cgi.exe -v" returned an error [-1072365564] '
Separately running
BitNami\rubystack-1.9.3-10\apache2\cgi-bin\php-cgi.exe -v
reports my version of PHP is 5.4.15. I am not sure if installing a an additional clean PHP will help. Or perhaps I should move on & push the app.

Categories