Google app engine php executable path not found - php

Followed the steps given on the official google app engine page for installing the sdk for php->
https://developers.google.com/appengine/docs/php/gettingstarted/helloworld
but I get this error in my browser on opening localhost.
The path specified with the --php_executable_path flag () does not exist.
How to set it ?
Installed on Ubuntu.

When starting dev appserver via the script one can pass in --php_executable_path pointing to the location of your php executable. The reason for the error is that it was unable to find php looking in the path and such. See documentation for example.
$ google_appengine/dev_appserver.py --php_executable_path=/opt/local/bin/php-cgi54 path/to/your/app

Install php5-cgi:
sudo apt-get install php5-cgi
Run app:
dev_appserver.py --php_executable_path=/usr/bin/php-cgi path/to/your/app

UPDATE: On linux use
sudo apt-get install php-cgi
dev_appserver.py --php_executable_path=/usr/bin/php-cgi app.yaml

On windows:
Download php at here https://www.php.net/downloads.php
Example the path for download D:\php72
Run app:
dev_appserver.py --php_executable_path="D:\php72\php-cgi.exe" path_app/app.yaml

Related

having problems with the shopify php api when looking for the shopify_api

PHP API using: https://github.com/sandeepshetty/shopify_api
I have PHP 5.3.27 installed
I installed Composer (by going to
the website and using their install.exe)
It mentions that
"This will download shopify_api into the
vendor/sandeepshetty/shopify_api directory."
But I do not see the folders or files anywhere on the computer.
The plugin author is saying that if you download Composer with the instructions he provided (via Terminal), then Composer will autoload those files for you. Unfortunately, though easier, simply going to the source URL for the Composer tool won't do that for you.
First, make sure you have created the composer.json file and stored it in your project directory. Then, log into your server or system via the command line (Terminal for Mac OS, Putty for Windows). Cd into your project directory, and install by entering these commands:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

What is php_executable_path in LAMP ubuntu12.04?

I am installing wordpress using Google App Engine and using this command to run the application, app_dir contains app.yaml, php.ini and wordpress:
google_appengine/dev_appserver.py app_dir/
and getting these errors:
File "/home/g1m/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 222, in new_instance
self._check_environment(php_executable_path)
File "/home/g1m/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 147, in _check_environment
'flag (%s) does not exist.' % php_executable_path)
_PHPBinaryError: The path specified with the --php_executable_path flag () does not exist.
I am trying to access the application using this url: localhost:8080 and get following error:
The path specified with the --php_executable_path flag () does not exist.
Kindly help me to solve this, what is the value of php_executable_path in LAMP as I am using UBUNTU12.04 operating system, is it /etc/php/cgi ?
Kindly let me know where I am doing wrong.
Make sure you install it first by doing:
sudo apt-get install php5-cgi
then locate it by running a search for php-cgi
sudo find / -name php-cgi
in my case i found it in : /usr/bin/php-cgi
I think the reason for this error is that GAE need to work with cgi not cli. The difference in them is that cli (command line interface) is for standalone application, not for web app (it didn't output html header by default). If php-cgi is installed , you can specify its path like this when you start dev server
<PATH_TO_SDK>app_devserver.py --php_executable_path=/usr/bin/php-cgi <your_project_name>
If you are not sure, you could search for it like dsb005 suggested.
If it's not installed... hmm... Maybe you miss this one on GAE document :
HP 5.4 is not packaged on most Linux distributions so it may be easiest to install it from source. On Debian-based Linux systems, you can use the following commands to install PHP 5.4 in such a way that it won't effect any other versions of PHP that you may have installed:
I suggest you follow the instruction on
https://developers.google.com/appengine/docs/php/gettingstarted/installinglinux and see if it works. It's always a pay off when you don't read the manual. I did that sometimes :(

Installing Composer in WAMP PHP Google+ Project, PHP is not recognised

I am following this PHP Google+ tutorial and I am trying to install composer in my WAMP directory
C:\wamp\www\gplus-quickstart-php>curl -s https://getcomposer.org/installer | php
but I'm getting this error
'php' is not recognized as an internal or external command operable
program or batch file.
How do I resolve this problem? I already have PHP installed (via WAMP Server). Do I have to install PHP in my computer as well?
Ok a couple of things you need to do here.
First windows does not have a curl processor like unix so you need to use the other option for installing Composer
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
For this to work you need the php.exe processor to be on your path, so you have 2 options here. Either add the c:\wamp\bin\php\phpx.y.z folder to your PATH thats the bad option for WAMPServer as you can have more than one version of PHP installed and when you activate another version your PATH will still be pointing at the Old version. Or my prefered option write yourself a little .cmd file which will do it for you like this
filename = addphp.cmd
PATH=%PATH%;c:\wamp\bin\php\phpx.y.z
Put this file in a folder already registered on your path so you can run it from anywhere in a command window.
Now you will have to edit the \wamp\bin\php\phpx.y.z\php.ini file. This is similiar to the one used by php code run through the Apache web server but is only used by the PHP CLI (Command Line Interpreter)
Make sure the extension php_curl is uncommented or the above line wont work i.e. remove the ; comment symbol
extension=php_curl.dll
So now run a command window, cd into the folder that you want composer installed into and run the command above, then follow the rest of the install instructions on Install instructions
On windows, just installed composer with windows installer -> easy and with wizard - like it.
https://getcomposer.org/Composer-Setup.exe
first you have to add your php path to system
after go to php.ini and rmove ; for extension=php_openssl.dll it will be active
3 run this command in cmd :
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
If using phpstorm you can download composer using their built in composer option in the tools menu.
You can run it from CLI by locating your php.exe, e.g
C:\wamp\bin\php\php7\php.exe composer.phar install
No idea if anyone will answer this late but I'm having issues with this. I created the .cmd file and put in the path as suggested. I put this file in my wamp\www\sitename folder. Is that not what you mean when you say putting it in a "registered path folder"? After creating the file, and running the code it still says php not recognized.
First, to get php into your path see my answer here
Installing composer is explained nicely here (code below just for illustration. Be sure to get latest from the link)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
A quick check to confirm it worked:
$ php composer.phar --version
Composer version 1.2.1 2016-09-12 11:27:19

Composer cannot download files

I am trying to use composer on command line :
php composer.phar update
php composer.phar install
php composer.phar self-update
php composer.phar selfupdate
Whatever I do I always receive the same error message:
File could not be downloaded. Failed to open stream
I am behind a proxy. If I use a browser and type the same URLs as the ones that didn't work with command line, there is no problem.
What should I do?
If you are using composer from behind an HTTP proxy, you can use the standard http_proxy or HTTP_PROXY env vars. Simply set it to the URL of your proxy. Many operating systems already set this variable for you.
eg:
HTTP_PROXY="http://my-corp-proxy.mcdonalds" php composer.phar install
bonus points if you throw it into your bashrc if your on Linux/OS X or your environment settings for Windows.
To make it easier, you can just export the variable, then you don't have to type it all the time.
export HTTP_PROXY="http://my-corp-proxy.mcdonalds"
php composer.phar install
The right an easy way to run composer on windows under a proxy is opening the console (cmd), go to your project location and run this command:
C:\wamp\htdocs\myproject\> SET HTTP_PROXY=http://username:password#proxy.yourdomain.com:8080 && php composer.phar install
PD: You must changes parameters like: username, password, proxy.yourdomain.com and 8080 to yours
I hope this help to you
And DO NOT set https_proxy (just http_proxy)!

Run php file via command line on an ubuntu linux server

I am trying to run a php file on a ubuntu linux server but get a 'command not found' error when i run "php file_name.php"
Searching online, i found an article that suggested I run "sudo aptitude install php5-cli" which I did and restarted apache afterwards but I still get this error.
How do I fix this?
Try this once,
Go to terminal.
whereis php
It will show where is php installed.
Export that path to environment variable using following command
export PATH=$PATH;/path/to/php's/bin directory
Then execute required file..
As follows,
php file_to_execute.php
first make sure that you've installed following packs:
php5
php5-cli
php-pear
like this:
sudo apt-get install php5 php5-cli php-pear
then make sure to configure php safely befor using it.
also make your php file executable ( chmod 700 )
Try the following step :
Open your cmd/console or press ctr+alt+t.
php5 /your/path/to/php_file_name.

Categories