Running HHVM in Alpine linux - php

I've been trying to install HHVM (Hack) on Alpine linux to no success.
Has anyone compiled HHVM on linux?
Any help would be welcome.

Up to now, there's no HHVM on Alpine yet.
There's an open request in the bug tracker, though:
http://bugs.alpinelinux.org/issues/4503
maybe you did this request :)
You can monitor the website to see if there are update, or check possibile pull requests from here:
https://github.com/alpinelinux/aports/pulls
Hope it helps.
Francesco

If you look at this page Building HHVM from source, it requires "GCC 5 or GCC 7". The first step would have to be `apk add --update build-base' or have a look here: How to get regular stuff working. buid-base contains "GCC, libc-dev and binutils packages" etc.

FROM alpine:3.7
RUN apk add --no-cache build-base git cmake patch curl-dev findutils libxml2-dev icu-dev bash libevent libevent-dev curl
RUN git clone git://github.com/facebook/hhvm.git
RUN cd hhvm
WORKDIR hhvm
RUN git submodule update --init --recursive
ENV GYP_DEFINES "linux_use_bundled_binutils=0 linux_use_bundled_gold=0 clang=0"
RUN cmake -DMYSQL_UNIX_SOCK_ADDR=/var/run/mysqld/mysqld.sock .
RUN make -j [number_of_processor_cores] # eg. make -j 4
RUN make install
Got stuck here:
-- Can't find minimal tcmalloc
ERROR: Unable to find Intel TBB install directory.
CMake Error at CMake/HPHPFindLibs.cmake:266 (if):
if given arguments:
"LESS" "5005"
Unknown arguments specified
Call Stack (most recent call first):
CMakeLists.txt:106 (include)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LIBGLOG_INCLUDE_DIR (ADVANCED)
used as include directory in directory /hhvm
used as include directory in directory /hhvm
Would get you going at least halfway.
Think the issue is around :https://pkgs.alpinelinux.org/package/edge/testing/x86/libtbb

Related

How to build a php extensions from tgz file using make?

Background
I use a RedHat machine without root access, no access to the yum packet manager and no Docker support. This is the policy unfortunately at my work.
I have configured Apache and PHP using a tar file in a folder. Also done same for MongoDB, now I try to configure the PHP drivers for MongoDB according to these instructions:
https://docs.mongodb.com/drivers/php/
However I get stuck on the first bullet:
sudo pecl install mongodb
Problem
Do I need PECL? Can the extension be downloaded manually, and added to PHP?
I have tried to download the mongodb extension manually from:
https://pecl.php.net/package/mongodb
How to compile it mongodb.so? I tried to run pecl on a machine where I have root access then I saw it downloaded the mongodb-1.10.0.tgz and run make (in output when installing).
When I unpack the tgz file manually, I am not able to run make. How to use the makefile.frag? How to run make?
Here is a link on how to build mongodb.so:
https://www.php.net/manual/en/mongodb.installation.manual.php
git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver
git submodule update --init
phpize
./configure
make all
sudo make install
You can also unpack the mongodb-1.10.0.tgz file with:
tar -xvf mongodb-1.10.0.tgz
phpize
make all
sudo make install

Compile error: "g++: error trying to exec 'cc1plus': execvp: No such file or directory"

When I compile C/C++ program with popen in php... I got this error:
g++: error trying to exec 'cc1plus': execvp: No such file or directory
but if I run php code in shell.. it works fine..
in Arch Linux..
PHP Code:
<?php
function rfile($fp) {
$out="";
while (!feof($fp)) {
$out.= fgets($fp, 1024000);
}
return $out;
}
$p = popen('g++ -Wall -g aplusb.cc -o aplusb 2>&1', 'r');
$result = rfile($p);
pclose($p);
echo $result;
?>
thanks
You need to install gcc-c++ package.
yum install gcc-c++
I don't know why but i just renamed my source file COLARR.C to colarr.c and the error vanished!
probably you need this
sudo apt-get install g++
This problem can happen if different versions of g++ and gcc are installed.
g++ --version
gcc --version
If these don't give the result, you probably have multiple versions of gcc installed. You can check by using:
dpkg -l | grep gcc | awk '{print $2}'
Usually, /usr/bin/gcc will be sym-linked to /etc/alternatives/gcc which is again sym-linked to say /usr/bin/gcc-4.6 or /usr/bin/gcc-4.8 (In case you have gcc-4.6, gcc-4.8 installed.)
By changing this link you can make gcc and g++ run in the same version and this may resolve your issue!
Each compiler has its own libexec/ directory. Normally libexec directory contains small helper programs called by other programs. In this case, gcc is looking for its own 'cc1' compiler. Your machine may contains different versions of gcc, and each version should have its own 'cc1'. Normally these compilers are located on:
/usr/local/libexec/gcc/<architecture>/<compiler>/<compiler_version>/cc1
Similar path for g++. Above error means, that the current gcc version used is not able to find its own 'cc1' compiler. This normally points to a PATH issue.
For apk, easiest way is:
apk add build-base
Install g++
on openSuSE run
zypper in gcc-c++
I had the same issue when forking with 'python'; the main reason is that the search path is relative, if you don't call g++ as /usr/bin/g++, it will not be able to work out the canonical paths to call cc1plus.
Something went wrong with your GCC installation. Try reinstalling the it like this:
sudo apt-get install --reinstall g++-5
In Ubuntu the g++ is a dependency package that installs the default version of g++ for your OS version. So simply removing and installing the package again won't work, cause it will install the default version. That's why you need to reinstall.
Note: You can replace the g++-5 with your desired g++ version. To find your current g++ version run this:
g++ --version
You may have this issue as well if you have environment variable GCC_ROOT pointing to a wrong location. Probably simplest fix could be (on *nix like system):
unset GCC_ROOT
in more complicated cases you may need to repoint it to proper location
I had the same issue with gcc "gnat1" and it was due to the path being wrong. Gnat1 was on version 4.6 but I was executing version 4.8.1, which I had installed. As a temporary solution, I copied gnat1 from 4.6 and pasted under the 4.8.1 folder.
The path to gcc on my computer is /usr/lib/gcc/i686-linux-gnu/
You can find the path by using the find command:
find /usr -name "gnat1"
In your case you would look for cc1plus:
find /usr -name "cc1plus"
Of course, this is a quick solution and a more solid answer would be fixing the broken path.

Upgrading PHP in XAMPP for linux?

How can I upgrade my current php (only) in xampp?
I need to upgrade from 5.3.1 to 5.4.0
Download PHP's source code and extract it in /usr/src:
cd ~/downloads
wget http://snaps.php.net/php5.4-latest.tar.gz
tar -xzf php5.4-latest.tar.gz
sudo mv php5.4 /usr/src/php-5.4
You need to find the configuration of already installed version , so you can use it and install the new version with the exact same configuration
/opt/lampp/bin/php --info | grep "Configure Command"
You should see something like this as result :
./configure '--prefix=/opt/lampp' '--with-apxs2=/opt/lampp/bin/apxs' '--with-config-file-path=/opt/lampp/etc' '--with-mysql=mysqlnd' '--enable-inline-optimization' '--disable-debug'
Actually, list should probably be much more longer. Copy and store it as you will need to use it as a whole later.
Make a backup of the current installation, in case if anything goes wrong
sudo cp -r /opt/lampp /opt/lampp.bak
Now that you have configuration options, review it and then use it to compile the new version.
cd /usr/src/php-5.4/
./configure --prefix=/opt/lampp --with-apxs2=/opt/lampp/bin/apxs --with-config-file-path=/opt/lampp/etc --with-mysql=mysqlnd --enable-inline-optimization --disable-debug
make
make install
Run /opt/lampp/bin/php -v in order to make sure you have correct php version installed. It should be 5.4.0 Beta.
Just want to complement #altern answer....
When I tried all the indications exactly in line of
make install
I had an error in the output
Installing PHP SAPI module: apache2handler
/opt/lampp/build/instdso.sh SH_LIBTOOL='/opt/lampp/build/libtool' libphp7.la /opt/lampp/modules
/opt/lampp/build/libtool --mode=install install libphp7.la /opt/lampp/modules/
/opt/lampp/build/libtool: 3215: /opt/lampp/build/libtool: install_prog+=install: not found
/opt/lampp/build/libtool: 3235: /opt/lampp/build/libtool: files+= libphp5.la: not found
libtool: install: you must specify an install program
libtool: install: Try `libtool --help --mode=install' for more information.
apxs:Error: Command failed with rc=65536
After looking for information to solve, I found a japanese link:
http://d.hatena.ne.jp/Kenji_s/touch/searchdiary?word=*%5BUbuntu%5D
What I did to solve it after trying to understand this japanese solution was simply:
sudo nano /opt/lampp/build/libtool
And when the editor was opened I changed the first line, instead of:
#! /bin/sh
I wrote:
#! /bin/bash
After that I tried again
make install
And voila it compiled!
Hope It helps someone
Now XAMPP is supporting PHP 5.4 and PHP 5.5. You can now download installer of your required version of PHP from http://www.apachefriends.org/en/xampp-linux.html
Thanks.

Any docs about V8JS in PHP?

Is there any documentation about V8JS?
Do I need only standard PHP or some extensions to use V8JS?
I'll be very thankful for any information about V8JS in PHP.
Requirements
PHP 5.3.3+ and V8 library and headers installed in proper paths.
Install
I've found this docs on the v8js class.
The docs out there aren't complete or are not updated. I'm actually currently in the process of doing v8JS myself and it took me a few days to get the back end libs sorted out. First off, you must know that you can't do this is you have python < 2.7
Here is my install notes that I'm putting together for our dev vagrant boxes running centos 7.
cd /tmp
# Install depot_tools first (needed for source checkout)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
# Download v8
fetch v8
cd v8
# Build (disable snapshots for V8 > 4.4.9.1)
make native library=shared snapshot=off -j8
# Install to /usr
sudo mkdir -p /usr/lib /usr/include
sudo cp out/native/lib.target/lib*.so /usr/lib64/
sudo cp -R include/* /usr/include
echo -e "create /usr/lib64/libv8_libplatform.a\naddlib out/native/obj.target/tools/gyp/libv8_libplatform.a\nsave\nend" | sudo ar -M
cd /usr/lib64
sudo chrpath -r '$ORIGIN' libv8.so
========================
Compile php-v8js itself
========================
cd /tmp
git clone -b master https://github.com/phpv8/v8js.git
cd v8js
phpize
./configure
make
make test
sudo make install
sudo service httpd restart
A note on the line make native library=shared snapshot=off -j8. I had the compile stop on me a couple times, I just restarted it. I'm not sure why it stopped, but it restarted just fine and completed just fine.
After that is done, you need to create the php extension file /etc/php.d/v8js.ini with the following content
; Enable v8js extension module
extension=v8js.so
Run the following to make sure it is installed correctly
php -r "phpinfo();" | grep v8js
If you get output back and no errors you're good to go.

How to install php-gtk in the Acer Aspire One?

I have an application that works pretty well in Ubuntu, Windows and the Xandros that come with the Asus EeePC.
Now we are moving to the Acer Aspire One but I'm having a lot of trouble making php-gtk to compile under the Fedora-like (Linpus Linux Lite) Linux that come with it.
I managed to get all components needed for Phoronix test suite installed on Fedora but still have one issue.
# phoronix-test-suite gui
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
/usr/bin/phoronix-test-suite: line 28: [: /usr/share/phoronix-test-suite: unary operator expected
You need two packages that aren't in Fedora, php-gtk, but php-gtk also has it's dependency - pecl-cairo
php-gtk needs to be downloaded from svn because tar.gz version is really old and doesn't work with php 5.3
Here is how I got all components built.
su -c "yum install php-cli php-devel make gcc gtk2-devel svn"
svn co http://svn.php.net/repository/pecl/cairo/trunk pecl-cairo
cd pecl-cairo/
phpize
./configure
make
su -c "make install"
cd ..
svn co http://svn.php.net/repository/gtk/php-gtk/trunk php-gtk
cd php-gtk
./buildconf
./configure
make
su -c "make install"
cd ..
wget http://www.phoronix-test-suite.com/download.php?file=phoronix-test-suite-2.8.1
tar xvzf phoronix-test-suite-2.8.1.tar.gz
cd phoronix-test-suite
su -c "./install-sh"
So please take where I left to get Phoronix test suite running on Fedora.
Hi Guys well I finally got this thing to work the basic workflow was this:
#!/bin/bash
sudo yum install yum-utils
#We don't want to update the main gtk2 by mistake so we download them
#manually and install with no-deps[1](and forced because gtk version
#version of AA1 and the gtk2-devel aren't compatible).
sudo yumdownloader --disablerepo=updates gtk2-devel glib2-devel
sudo rpm --force --nodeps -i gtk2*rpm glib2*rpm
#We install the rest of the libraries needed.
sudo yum --disablerepo=updates install atk-devel pango-devel libglade2-devel
sudo yum install php-cli php-devel make gcc
#We Download and compile php-gtk
wget http://gtk.php.net/do_download.php?download_file=php-gtk-2.0.1.tar.gz
tar -xvzf php-gtk-2.0.1.tar.gz
cd php-gtk-2.0.1
./buildconf
./configure
make
sudo make install
If you want to add more libraries like gtk-extra please type ./configure -help before making it to see the different options available.
After installing you'll need to add php_gtk2.so to the Dynamic Extensions of /etc/php.ini
extension=php_gtk2.so
Sources:
[1]: Dependency problems on Acer Aspire One Linux
If you could give us more to go on than just trouble making it compile; we might be better able to help you with your issues.

Categories