Adding php-curl in a Yocto build - php

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

Related

How to run node module in php and display output?

I have a use case where i need to run a node module in php script and display it's output back on the page. Here's the steps I followed:
I have installed the module npm install -g md2gslides
I am using PHP's exec() for running the module
exec('node_modules/md2gslides/bin//md2gslides.js --version 2>&1', $output);
But it's not working. The error is below:
However, it runs in ubuntu's terminal without issues.
What is wrong here?
The error not because of php but because of the path.join() in line 33 of md2gslides.js
const STORED_CREDENTIALS_PATH = path.join(USER_HOME, '.md2googleslides', 'credentials.json');
It tries to find the credentials.json in users home directory. But I think it's unable to.
So I moved the file to node_modules/md2gslides/bin and modified path.join() as path.join(__dirname, '.md2googleslides', 'credentials.json')
This solved the issue.

How can I use Kalabox with a WordPress Install that has a nested web root?

I have been trying and failing for a week to get Kalabox working with a WordPress install that has a nested web root with Pantheon. I've found some great resources, but many of them are for Drupal and they don't seem to translate to the WP installs, like the great post by Tandem here: https://www.thinktandem.io/blog/2017/05/20/using-pantheon-s-nested-docroot-with-kalabox/
Does anyone have a quick walkthrough that would work? Thanks!
I figured it out! Here's what it took:
1. Setup A Site In Pantheon
Create Sites
2. Clone the Site to your local machine using Kalabox
Make sure you've installed Kalabox on your machine. This will also install Docker, if you haven't already installed it. Now, open your terminal.
mkdir -p ~/Kalabox
cd ~/Kalabox
kbox create pantheon
# follow the prompts to clone down your Pantheon site
3. Add Your Site Code
This is where the real work starts. Make sure you're in the main Kalabox directory. I'm using the excellent Advanced Wordpress On Pantheon as the boilerplate for this app. But you can use whatever you'd like.
# replace text in < > with your site name
cd ~/Kalabox/<your-site-name>
rm -rf code/
# Clone this or copy your own site code into the code directory
git clone https://github.com/ataylorme/advanced-wordpress-on-pantheon.git code
If you're using the Advanced WordPress install above, type the following lines, as well:
cd code/
./bin/local-build.sh
Make certain you added your code into the ~/Kalabox/<your-site-name>/code/ directory.
You can visit your site now at http://.kbox.site on your browser, but if you have a nested web root, you'll likely see an Nginx 500 error. This is the problem we're trying to fix!
4. Edit The Kalabox Setup to Allow A Nested Web Root
This part is the secret sauce. We have to get into the Docker container that Kalabox has setup and change the nginx configuration files. If all that sounds like non-sense to you, don't worry. These simple instructions should help you do it! Back to the terminal!
docker ps
This dumps a table with a list of the running Docker containers. Find the one that says nginix under the Image column. Look immediately to the left in the Container ID column. Note, copy and/or write down the first four-or-so letters of that container ID. You'll use those in the <container-id> part of this next command:
docker exec -i -t <container-id> bash
This opens a pseudo remote shell with your nginx container. Yay! Now we can edit the nginx files and get our site up-and-running! The command line probably changed a bit, showing your user as root#<your-site-name>. That means it worked.
The nginx container doesn't have a text editor downloaded by default. So, we'll download a tiny little text editor called Nano.
apt-get update
apt-get install nano
Once those commands are finished running, we can edit the config file:
nano /etc/nginx/conf.d/default.conf
This opens the Nano editor with the configuration file we're trying to edit. Look and change the following lines:
# This one is near the top of the file
# Before
root /code;
# After
root /code/web;
# These next two are near the bottom of the file.
# This exact line appears twice--once in the `location ~ ^/simplesaml/`
# block, and once in the `location ~ \.php$` block. Edit it in
# BOTH locations.
#
# Before
fastcgi_param SCRIPT_FILENAME /code/$fastcgi_script_name;
# After
fastcgi_param SCRIPT_FILENAME /code/web/$fastcgi_script_name;
When you're done with that, type <Ctrl-o> <Enter> <Ctrl-x> to save your work and exit. You're back at the pseudo shell for your Docker container. Type exit to go back to your normal command line.
5. Rebuild Kalabox & Test It Out!
Make sure you're in the ~/Kalabox/<your-site-name> directory, and type kbox restart just to make sure you've got everything cleared out of the Kalabox caches. Kalabox will stop and restart your site for you. Once it's done, visit http://.kbox.site in your browser to see your work!
Extra Goodies
Upgrade to PHP 7: Open ~/Kalabox/<your-site-name>/kalabox.yml in your favorite editor, and change line 33 to php: 70.
Remove Undefined Index: NONCE_KEY error: open ~/Kalabox/<your-site-name>/config/php/prepend.php and go to roughly line 55 which reads $_ENV['NONCE_SALT'] = getenv('NONCE_SALT');. Below it, add a similar line: $_ENV['NONCE_KEY'] = getenv('NONCE_KEY');

Python setup.py egg_info failed with error code 1 at pip install psycopg2

[root#Nav15 nav15]# pip install psycopg2
Collecting psycopg2
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached psycopg2-2.6.2.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
/tmp/pip-build-Fh_XN3/psycopg2/setup.py:12: DeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Fh_XN3/psycopg2

Deploy PHP using cURL in GAE

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.

WSO2 WSF/PHP installation problems (C devs help needed)

I'm trying to install WSO2 WSF/PHP extension to use SOAP with WSSE.
I was having problems when I was compiling sources, I needed to checkout trunk (instead of tag 2.1) from their repository, couple of times I fixed php 5.4 compatibility issues in source codes, finally everything compiled successfully
But when I try to enable this extension I get an error:
user#centos:~/wsf$ php -i | grep "wsf"
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525+lfs/wsf.so' - /usr/lib/php5/20100525+lfs/wsf.so: undefined symbol: rampart_context_set_prv_key in Unknown on line 0
/etc/php5/cli/conf.d/20-wsf.ini,
PWD => /home/user/wsf
_SERVER["PWD"] => /home/user/wsf
I did grep on sources and found this:
user#centos:~/wsf$ grep -r "rampart_context_set_prv_key" .
./src/.svn/text-base/wsf_policy.c.svn-base: rampart_context_set_prv_key(rampart_context, env, Z_STRVAL_PP(token_val));
./src/.svn/text-base/wsf_policy.c.svn-base: if (rampart_context_set_prv_key_type (rampart_context, env, AXIS2_KEY_TYPE_PEM) == AXIS2_SUCCESS)
Binary file ./src/modules/wsf.so matches
./src/wsf_policy.c: rampart_context_set_prv_key(rampart_context, env, Z_STRVAL_PP(token_val));
./src/wsf_policy.c: if (rampart_context_set_prv_key_type (rampart_context, env, AXIS2_KEY_TYPE_PEM) == AXIS2_SUCCESS)
Binary file ./src/.libs/wsf.soT matches
Binary file ./src/.libs/wsf.so matches
Binary file ./src/.libs/wsf_policy.o matches
Binary file ./wsf_c/rampartc/src/util/.libs/librampart.so.0 matches
Binary file ./wsf_c/rampartc/src/util/.libs/librampart.a matches
Binary file ./wsf_c/rampartc/src/util/.libs/librampart.so.0.3.0 matches
Binary file ./wsf_c/rampartc/src/util/.libs/rampart_context.o matches
Binary file ./wsf_c/rampartc/src/util/.libs/librampart.so matches
./wsf_c/rampartc/src/util/rampart_context.c:rampart_context_set_prv_key(rampart_context_t *rampart_context,
./wsf_c/rampartc/src/util/rampart_context.c:rampart_context_set_prv_key_type(rampart_context_t *rampart_context,
./wsf_c/rampartc/src/util/rampart_context.c:rampart_context_set_prv_key_password(rampart_context_t *rampart_context,
Binary file ./wsf_c/rampartc/src/util/rampart_context.o matches
./wsf_c/rampartc/include/rampart_context.h: rampart_context_set_prv_key(rampart_context_t *rampart_context,
./wsf_c/rampartc/include/rampart_context.h: rampart_context_set_prv_key_type(rampart_context_t *rampart_context,
./wsf_c/rampartc/include/rampart_context.h: rampart_context_set_prv_key_password(rampart_context_t *rampart_context,
So basically I found only 1 file, wsf_policy.c which uses rampart_context_set_prv_key, but includes looks correct, and I don't know how to solve it. Any ideas?
Same Problem. Solved in the same way as in Error when trying to run security examples in wsf/php 2.1:
sudo apt-get install gcc-4.4
and then configuring wsf/php by running
./configure CC=gcc-4.4
Follow the rest of the normal installation steps and it should work.
You can also check the wsf.so library to see if it has the rampart libs linked in it by doing
ldd /usr/lib/php5/20090626/wsf.so
Also, just in case you haven't found it yet, here are the steps to compile WSF using PHP 5.4
https://wso2.org/jira/browse/WSFPHP-477
In my installation, the symbol "rampart_context_set_prv_key" is defined in the library ${wsf.home}/lib/librampart.so which is directly accessible from wsf.so thank to RPATH variable.

Categories