Deploy PHP using cURL in GAE - php

I just received a great news that full cURL is supported now.
I followed the instruction to replace "runtime:php" with "runtime:php55" in app.yaml and deployed my php code to Google App Engine using Google App Engine Launcher.
The system responsed error as attached:
..deploy response...............
2015-02-27 23:01:52 Running command: "['C:\\python27_x64\\pythonw.exe', '-u', 'C:\\Program Files\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\google_appengine\\appcfg.py', '--no_cookies', u'--email=jihshiun#gmail.com', '--passin', 'update', 'D:\\Documents\\GAE CloudSite\\Hi']"
Usage: appcfg.py [options] update <directory> | [file, ...]
appcfg.py: error: Error parsing D:\Documents\GAE CloudSite\Hi\app.yaml: Unable to assign value 'php55' to attribute 'runtime':
Value 'php55' for runtime does not match expression '^(?:contrib-dart|dart|go|php|python|python27|java|java7|vm|custom)$'
in "D:\Documents\GAE CloudSite\Hi\app.yaml", line 3, column 10.
2015-02-27 23:02:04 (Process exited with code 2)
.......................
I also tried to add a php.ini with extension = "curl.so" in the file, and the deployment failed too with the same response.
Have I missed something?
Please advise.

I've had the same problem.
You have to update the sdk, download the file corresponding to your plataform and instal it.

Related

Adding php-curl in a Yocto build

I've been building a custom image using Yocto and wpewebkit to use within docker. I need to run a local web server with php, which I have accomplished no problem. I need to use curl within my project and I have apache2, php, modphp, and curl installed. All I need is php-curl but I cannot find how to install this. Does anyone know how or if I can do this? I've put in all my efforts on googling multiple phrases but I only find how to install php-curl using apt-get or yum, or I get links to the meta-* directories which I have access to within my build files anyways.
If it helps at all, this custom image was based on the image provided from the following project on GitHub: https://github.com/resin-io-playground/resin-wpe/tree/master/base-image . I already spoke to the developer and their knowledge of PHP is limited.
EDIT #1: Progress so far, had to update the curl.bb file to properly include libcurl-dev, and then worked with #pmod's suggestion to incorporate curl into the php build. Everything seemed to run okay until I received the following error:
| ../php-7.1.9/configure: line 386: test: please: integer expression expected
| configure: error: reinstall
| ../php-7.1.9/configure: line 275: return: please: numeric argument required
| ../php-7.1.9/configure: line 285: exit: please: numeric argument required
| NOTE: The following config.log files may provide further information.
| NOTE: /base-image/build/tmp-glibc/work/x86_64-linux/php-native/7.1.9-r0/build/config.log
| ERROR: configure failed
| WARNING: /base-image/build/tmp-glibc/work/x86_64-linux/php-native/7.1.9-r0/temp/run.do_configure.29590:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_configure (log file is located at /base-image/build/tmp-glibc/work/x86_64-linux/php-native/7.1.9-r0/temp/log.do_configure.29590)
ERROR: Task (virtual:native:/base-image/build/../meta-openembedded/meta-oe/recipes-devtools/php/php_7.1.9.bb:do_configure) failed with exit code '1'
Edit #2: I've gone ahead and added everything I was missing. I'm getting the same error above, where the function do_configure during the php build is failing. I'm posting below what I ensured I have in my curl.bb file (I had to add this), what I have in my php.inc file, and the curl files located staging directory.
curl.bb:
PACKAGES =+ "lib${BPN} lib${BPN}-native lib${BPN}-dev lib${BPN}-dev-native"
FILES_lib${BPN} = "${libdir}/lib*.so.*"
FILES_lib${BPN}-dev = "${includedir} \
${libdir}/lib*.so \
${libdir}/lib*.a \
${libdir}/lib*.la \
${libdir}/pkgconfig \
${datadir}/aclocal \
${bindir}/*-config"
php.inc:
EXTRA_OECONF_append = " --with-curl=${libdir}/.."
DEPENDS_${PN} += "libcurl-dev libcurl-dev-native"
PHP Staging Directory:
/installeddeps/curl-native
/installeddeps/curl-native.b77f37db31cf2391919a12c5c9774bff
/installeddeps/curl-native.complete
/usr/share/aclocal/libcurl.m4
/usr/bin/curl-config
/usr/bin/crossscripts/curl-config
/usr/bin/curl
/usr/lib/pkgconfig/libcurl.pc
/usr/lib/libcurl.so
/usr/lib/libcurl.a
/usr/lib/libcurl.so.4.4.0
/usr/lib/libcurl.so.4
/usr/include/curl
/usr/include/curl/curl.h
/usr/include/curl/curlrules.h
/usr/include/curl/curlbuild.h
/usr/include/curl/curlver.h
/usr/include/curl/easy.h
According to php manual, PHP/cURL feature is enabled at php configuration stage with --with-curl=[dir] option.
I checked the main recipe include file php.inc and couldn't find such configuration option. So, try creating in your working layer php_%.bbappend file with (or add this directly to the bottom of php.inc to test):
EXTRA_OECONF_append_class-target = " --with-curl=${STAGING_LIBDIR}/.."
DEPENDS_append_class-target = " curl"
Note, that curl package among DEPENDS because it is needed at build stage.
I don't think you need to update curl recipe with PACKAGES and FILES, pkg_config should take care

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.

Deploying existing local project to Bluemix BuildPack error

I hope someone can help me out with this issue I'm facing.
I've made a fully functional project on a local server and would now like to deploy it to Bluemix Cloud Foundry.
I've followed the tutorial: https://console.eu-gb.bluemix.net/docs/starters/upload_app.html
But when I'm trying to push it through terminal with following commands
cf push app_name -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
cf push app_name -b https://github.com/cloudfoundry/go-buildpack
cf push app_name -c start_command
cf push app_name -m 512m
But non seems to work, since every single time I get the following error
Staging failed: Buildpack compilation step failed
-----> Composer command failed
FAILED
Error restarting application: BuildpackCompileFailed
It is a PHP app build with PHPStorm on Symfony and Doctrine if that matters.
I am fairly new to all server/setup/deployment configurations as well as command line.
EDIT 1
I figured out this part thanks to this link: https://support.run.pivotal.io/entries/109600943-cf-push-ing-a-symfony-app-fails-with-Composer-command-failed-
It seems that by default the buildpack assumes that you want all of the files you push to be public. Because of this assumption, it takes all of your files and moves them into the doc root of either HTTPD or Nginx.
By creating the file .bp-config/options.json in the root of your project. Then inside options.json add
{
"WEBDIR": "web"
}
This will tell the buildpack that you have a specific directory to use for the doc root, so it will just use that instead of moving everything into the default doc root.
However...
This brings me a new issue and returns the following error
FAILED
Error restarting application: Start unsuccessful
If i enter the recent log the terminal provides me this:
2016-08-25T02:53:40.62+0200 [App/0] OUT Could not open input file: app.php
2016-08-25T02:53:40.62+0200 [App/0] ERR
2016-08-25T02:53:40.69+0200 [DEA/211] ERR Instance (index 0) failed to start accepting connections
2016-08-25T02:53:40.72+0200 [API/9] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-25T02:53:40.72+0200 [API/3] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-24T16:41:14.03+0200 [DEA/135] OUT Starting app instance (index 0) with guid abb206b3-b8ea-4269-b248-ec7b35f7098a
2016-08-24T16:41:26.26+0200 [App/0] ERR bash: start_command: command not found
2016-08-24T16:41:26.26+0200 [App/0] OUT
2016-08-24T16:41:26.35+0200 [DEA/135] ERR Instance (index 0) failed to start accepting connections
2016-08-24T16:41:26.38+0200 [API/6] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"5ebd6d77-68c4-4901-b9a8-b5cecfa4cddb", "instance"=>"7b5b555ae68645f4a2c09b73c0adbcb3", "index"=>0, "reason"=>"CRASHED", "exit_status"=>127, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472049686}
EDIT 2 (updated error msg)

Unable to run google app engine script with PHP

So, I'm trying to run the Hello World script but whenever I run dev_appserver.py I hit a wall.
Here's the error log from the script:
$ appengine/dev_appserver.py --php_executable_path=/usr/local/bin/php-cgi HelloWorld
...
ERROR 2016-03-29 12:57:30,588 php_runtime.py:348] The PHP runtime
is not available Traceback (most recent call last): File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 344, in new_instance
self._check_binaries(php_executable_path, gae_extension_path) File
"/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 284, in _check_binaries
cls._check_environment(php_executable_path, env) File "/Users//desktop/appengine/google/appengine/tools/devappserver2/php_runtime.py",
line 259, in _check_environment
raise _PHPEnvironmentError(check_process_stdout)
_PHPEnvironmentError: No input file specified.
As a background to my El Capitan setup...
I've previously updated PHP to 5.5 using:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
But I've also downloaded via HomeBrew php54 and that's what should be running the php-cgi script I've posted in the executable path above.
Any thoughts?
So turns out, the answer was pretty obvious - I'd installed the Go SDK rather than the PHP one! Google's website scrolls to the wrong place when you click PHP. Many hours wasted trying to fix this one - never mind. Hope this helps another as simple as me!
if you already installed google-cloud-sdk run this command :
gcloud components install app-engine-php-darwin
you won't need to specify that path after this

Path specified --php_executable_path does not exist -- GAE php HelloWorld

Setup the GAE PHP sandbox on my Linux laptop (running Debian 'Wheezy' 32-bit, latest packages). Setup was done following the 'Installing the SDK' instructions, followed by an attempt at the 'Getting-Started > Hello World' application, following the instructions.
However, when I visit http://local.host.com:8080*, I get the following message, instead of 'Hello World!':
The path specified with the --php_executable_path flag () does not exist.
*Note: SO doesn't allow URL pointing to localhost, so replaced it with local.host.com! It is not a mistake.
On the console where I'd started the app_server, I see the following error-message:
ERROR 2014-04-29 03:34:36,219 php_runtime.py:223] The PHP runtime is not available
Traceback (most recent call last):
File "/home/icarus/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 219, in new_instance
self._check_environment(php_executable_path)
File "/home/icarus/google_appengine/google/appengine/tools/devappserver2/php_runtime.py", line 148, in _check_environment
'flag (%s) does not exist.' % php_executable_path)
_PHPBinaryError: The path specified with the --php_executable_path flag () does not exist.
Note that I've installed the latest php-5.4.27 (instructions talk of php-5.4.25, but later go on to say in a NOTE that we can get the latest from PHP website), and built it on my machine, successfully as per instructions.
Is the php-5.4.25 hardcoded anywhere, s.t. it is not found, as on my machine I've got php-5.4.27 ? Here is what I see:
$ ls -l ~/php-5.4.27/installdir/bin/php-cgi
-rwxr-xr-x 1 icarus icarus 23195302 Apr 28 22:58 php-cgi
Python installed is 2.7.3, and the google_appengine SDK is latest stable i.e. 1.9.3.
Argh... I ignored to see the plethora of questions already on SO, on this (or nearly this) subject, most perhaps from newbies like me.
Based on this other SO question's answer, I started the SDK like this:
$ google_appengine/dev_appserver.py --php_executable_path=php-5.4.27/installdir/bin/php-cgi work/gae_apps/helloworld/
and finally 'Hello World!' worked as expected. Perhaps, this calls for bit of clarification / elaboration on the 'Getting Started' page ?

Categories