I've recently been setting up a new environment for a web application I'm working on and I've run into this following issue that I cannot figure out.
Currently I have a docker-composer setup based off of https://hub.docker.com/r/ruslangetmansky/docker-apache-php/
Where I have my API, APP and DB running and need them to talk between each other.
During the initialisation of this, I'm currently doing the following command:
command: bash -c 'apt-get update && apt-get -y install curl libcurl3 libcurl3-dev php5-curl php5-oauth && rm -rf /var/lib/apt/lists/* && composer install && /sbin/entrypoint.sh'
I've even tried separating out the php5-oauth in-case we're running into a timing issue like so, but the same issue persists:
command: bash -c 'apt-get update && apt-get -y install curl libcurl3 libcurl3-dev php5-curl && apt-get -y install php5-oauth && rm -rf /var/lib/apt/lists/* && composer install && /sbin/entrypoint.sh'
As you can see, I've been trying everything to get php5-oauth built with cURL support, however at the moment the current build ends up with only php_streams request engine support:
However it looks like cURL support is also built in:
So currently when I boot my app+api, I can't talk between them due to no cURL support, as I've errors all over my application complaining of undefined constants such as the two following:
Message: Use of undefined constant OAUTH_REQENGINE_CURL - assumed 'OAUTH_REQENGINE_CURL'
and
Message: OAuth::setRequestEngine() expects parameter 1 to be long, string given
due to the lack of cURL support.
I also spotted similar questions around Stack Overflow, but nothing seems to mention what to do when these are installed and enabled but only 1 request engine is available.
Other research has led me to http://www.davidogilo.co.uk/technical/how-to-fix-oauth_reqengine_curl-is-undefined/ but my cURL default path has always been found succesfully.
Can anyone give me a hand here, or at least point out where i'm possibly going wrong? Cheers.
Reinstall oauth with sudo pecl install oauth to compile it with cURL support
Related
So I have 2 Dockerfile to build my container. The first file is to build my "main" (production) container, the second extends the first (through From instruction) and adds some dev and testing dependencies.
Currently, my only testing dependency is Xdebug. I install it through PECL with : RUN pecl install xdebug && docker-php-ext-enable xdebug
When I rebuild my image, it seems that it doesn't rebuild everything from scratch so I get the error pecl/xdebug is already installed and is the same as the released version 2.9.8 install failed ERROR: Service 'webapi' failed to build : The command '/bin/sh -c pecl install xdebug && docker-php-ext-enable xdebug' returned a non-zero code: 1
So, ok, it fails, but I still end with Xdebug installed so my image will work just fine. But it stops the build. I don't want to.
I've seen the RUN command; exit 0 trick but, as mentionned by somebody, it will silence any real error (like "Sorry, server unreachable, can't download Xdebug") so to me it's not a viable option for production.
Also Xdebug isn't available on apt-get nor through docker-php-ext-install. I'm stuck with PECL.
Do you know any option (like some hidden param) to do something like "Install if you can, otherwise just like it roll" ?
Regards,
You can check if Xdebug is installed or not first:
bash -c '[[ -z "$(pecl list | grep xdebug)" ]] && (pecl install xdebug && docker-php-ext-enable xdebug)'
But honestly 'it doesn't rebuild everything from scratch' sounds quite weird in the first place and you probably should debug your Dockerfile.
Put this in your Dockerfile when you want to install XDebug:
RUN bash -c '[[ -n "$(pecl list | grep xdebug)" ]]\
|| (pecl install xdebug && docker-php-ext-enable xdebug)'
This will check the pecl installed packages list for 'xdebug' before attempting an install.
If grep returns anything for that, we know it's already installed and the statement evaluates to success.
If grep doesn't return anything, it'll go ahead and execute the commands to install xdebug, and fail if it's unable to install it.
I installed node on my Ubuntu 14.04 machine with:
apt-get install node
However, when I run
node -v
there is no output.
I then tried apt-get install nodejs, and when I run nodejs -v I get v0.10.25.
I'm not really sure what I'm doing wrong to get node working.
My PHP script requires node.js and my check keeps failing:
if(preg_match("/^v\d+.\d+.\d+$/", `node -v`) === 0){
exit_json([
"error" => "Node isn't installed on this machine."
]);
}
How can I correctly install node.js on 14.04? I used digital ocean's tutorial.
If you are using Node.js as a developer in you developing machine I advise you to install it using NVM.
Follow the instructions than add the following to your ~/.bashrc file:
source ~/.nvm/nvm.sh
After type
$source ~/.bashrc
This will allow you to use NVM to install the versions you want:
$nvm install 10
You can install older versions and use whatever one you have installed by typing:
$nvm use 8.4.0
If you want to execute it, make sure you're specifying the full path (or make sure node is in the path.)
Also, that's a very, very old version of Node.js you've installed.
Try install like this :
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
I recently installed Solarium (with Java 8 on Ubuntu 14.04, PHP 5.5).
I created a core called test :
$ sudo -u solr /opt/solr-6.5.1/bin/solr create -c test
Then I indexed in it the "techproducts" example :
$ bin/post -c test example/exampledocs/*.xml
So I then tried to execute a PHP file given as an example with Solarium. In SSH I do :
$ php 1.2-basic-select.php
And it works, it shows the content indexed.
But, when I open this same PHP file with a browser, I've got an error :
Fatal error: Uncaught exception 'Solarium\Exception\RuntimeException' with message 'cURL is not available, install it to use the CurlHttp adapter' in /var/www/html/cvrecruteur.com/slr/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php:228
Curl and php-curl are installed and up to date so I don't really know what's the deal here.
try to install PHP5 CURL by typing sudo apt-get install php5-curl
If you're really sure that php5-cur are installed, try to restart your apache instance.
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
As the title says, I've go a clean install of Laravel 5.4 and the latest Homestead (1.0.1). However, when I run a simple Dusk test case I get the following error:
Failed to connect to localhost port 9515: Connection refused
Anyone know how to deal with this? I tried changing the port to something else such as 8888 to no avail.
EDIT:
I've been able to dig a little deeper and found out that the chromedriver executable was not actually executable (chmod). Now that I've fixed that I get this error when I manually try to run it.
./chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
For those looking for a solution on Mac, I've just had to restart Chrome. Yes, Chrome, the browser. It seems it'd a pending update (it said that in the upper right corner).
Restarting it, and later chromedriver, make everything went fine
I had this issue today and the solution is on Laracasts.
Here's a copy.
# makes sure all your repos are up to date
sudo apt-get update
# chrome dependencies I think
sudo apt-get -y install libxpm4 libxrender1 libgtk2.0-0 libnss3 libgconf-2-4
# chromium is what I had success with on Codeship, so seemed a good option
sudo apt-get install chromium-browser
# XVFB for headless applications
sudo apt-get -y install xvfb gtk2-engines-pixbuf
# fonts for the browser
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
# support for screenshot capturing
sudo apt-get -y install imagemagick x11-apps
# Once all this has run through, you need to fire up xvfb on your homestead box. If you’re planning to # do this on a regular basis, you’ll want to get this setup on boot, but for the sake of testing things out:
Xvfb -ac :0 -screen 0 1280x1024x16 &
On Ubuntu Linux 16.04, I got this to work:
Install Chromium & dependencies for headless testing
sudo apt-get -y install chromium-browser xvfb gtk2-engines-pixbuf xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable imagemagick x11-apps
Create a customDuskCommand
Which extends the original, with this handle method:
public function handle()
{
$xvfb = (new ProcessBuilder())
->setTimeout(null)
->setPrefix('/usr/bin/Xvfb')
->setArguments(['-ac', ':0', '-screen', '0', '1280x1024x16'])
->getProcess();
$xvfb->start();
try {
parent::handle();
} finally {
$xvfb->stop();
}
return;
}
This will start Xvfb for headless testing before executing the tests and stop the process after testing completes.
Edit: And make sure vendor/laravel/dusk/bin/chromedriver-linux is executable.
Failed to connect to localhost port 9515 after 0 ms: Connection refused
Solution:
php artisan dusk:install
php artisan dusk:chrome-driver 65
It appears your chrome-driver installation is broken.
You can try to install it from scratch
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip
sudo mv -f ~/chromedriver /usr/local/bin/chromedriver
sudo chown root:root /usr/local/bin/chromedriver
sudo chmod 0755 /usr/local/bin/chromedriver
This should help you download the latest version of chrome driver and unpack it properly.
LATEST_VERSION=$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE) && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.co /$LATEST_VERSION/chromedriver_linux64.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;
Create a customDuskCommand
namespace App\Console\Commands;
use Symfony\Component\Process\Process;
class DuskCommand extends \Laravel\Dusk\Console\DuskCommand {
public function handle() {
$xvfb = (new Process(['/usr/bin/Xvfb', '-ac', ':0', '-screen', '0', '1280x1024x16']))
->setTimeout(null);
$xvfb->start();
try {
parent::handle();
} finally {
$xvfb->stop();
}
return;
}
}
Thanks to https://stackoverflow.com/a/44322930/470749. It was outdated and didn't work, so I'm providing an updated answer that works.
UPDATE:
I personally don't follow this approach anymore. After I deployed to production, I got this error: E_ERROR: Class 'Laravel\Dusk\Console\DuskCommand' not found because I'd forgotten that my composer.json only installed Dusk in the dev environment rather than also in production. If you adhere to the principle that "test code" shouldn't be deployed to production, then this approach of writing a custom class that extends \Laravel\Dusk\Console\DuskCommand probably is not for you (since the DuskCommand dependency won't exist in production).
I will leave this answer here anyway since it's hopefully a valuable warning to people. Please comment if you think I should delete it instead. By the way, Jonas Staudenmeir tends to have great answers, so this looks interesting as an alternative.
With the latest laravel/homestead box v.6.0.0 it's working out of the box
https://app.vagrantup.com/laravel/boxes/homestead