Solr Solarium and Curl throwing an error - php

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.

Related

No output when trying to use nodejs

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

Install and integrate tcpdf in php scripts on Debian 8

I have a Debian 8 distribution and am trying to get the tcpdf php library running for generating pdf documents. I notice that it is already installed as a package when searching for it in Synaptic Package Manager. It's version 6.0.093+dfsg-1 and its location is /usr/share/doc/php-tcpdf. I looked around online for instructions and tutorials for using the library in my php scripts but haven't found anything explicit and instructive. Neither do the official sites: https://tcpdf.org/ and https://github.com/tecnickcom/tc-lib-pdf offer any setup, installation, or integration documentation.
I downloaded the TCPDF-master.zip from https://github.com/tecnickcom/TCPDF , pasted it into my /var/www/html/ directory, but when I try running one of the examples, or the index.php file, the browser just gives me the following error:
The localhost page isn’t working localhost is currently unable to handle this request. HTTP ERROR 500
The error.log file at /var/log/apache2 displays:
PHP Fatal error: Unknown: Failed opening required '/var/www/html/tcpdf/examples/example_001.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
I received the same errors even after installing PEAR and also when trying to run the fpdf library.
Please instruct me to follow the proper procedure on correctly using this library. Thanks.
First, install composer as described at http://www.bravo-kernel.com/2014/08/how-to-install-composer-on-debian/ . Make it globally available by running the following commands while logged in the terminal as user:
$ cd /usr/src
$ sudo apt-get install curl php5-cli
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
If the terminal responds with the following errors:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
a system restart might be needed due to a possibility of apt-get (or some GUI frontend to it) being halted while executing, leaving apt in a locked state.
Verify the installation:
$ composer --version
which should output:
Composer version 1.3.0 2016-12-24 00:47:03
or something similar.
Afterwards, navigate to the desired directory within terminal where you want to locally install the composer dependency. For instance: /var/www/html/ which is the web root on Debian. Input the command for installing the tcpdf php library:
composer require tecnickcom/tcpdf
as stated at https://packagist.org/packages/tecnickcom/tcpdf
All should now operate as intended.

How do I uninstall a PHP module?

I bumped into this bit of instructions while installing an addon for a PHP framework:
Make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:
sudo apt-get purge php5-geoip
I am working on Windows PC with a Virtual Machine running Laravel Homsetead. I am using Git Bash command window. When I enter the above command I get:
bash: sudo: command not found
If I remember correctly, sudo is an Apple-related command so I tried dropping it like this:
apt-get purge php5-geoip
but I get
bash: apt-get: command not found
What command do I need to use to purge php5-geoip?
EDIT: echo $PATH gives out:
$ echo $PATH
/c/Users/Arthur/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/
bin:/c/Users/Arthur/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:
/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/
c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x86:/c/Program Files (x86)/Intel/
OpenCL SDK/2.0/bin/x64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c
/Program Files/MATLAB/MATLAB Production Server/R2015a/runtime/win64:/c/Program F
iles/MATLAB/MATLAB Production Server/R2015a/bin:/c/Program Files/MATLAB/MATLAB P
roduction Server/R2015a/polyspace/bin:/c/Program Files (x86)/Skype/Phone:/c/PHP:
/c/ProgramData/ComposerSetup/bin:/c/Users/Arthur/AppData/Roaming/Composer/vendor
/bin:/c/HashiCorp/Vagrant/bin:/c/Program Files/nodejs:/c/Users/Arthur/AppData/Ro
aming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl

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.

Installing RabbitMQ PHP: Fatal error: Class 'AMQPConnection' not found

I've already installed the RabbitMQ on my server and everything is working fine with it. I already tried to send and receive queued messages with a Java client and everything went perfect.
Now I need to install a PHP RabbitMQ client because I want to communicate a Java program with a PHP webpage, but this time I'm not beign so lucky.
I already followed the steps of the official webpage for this installation, specifically these steps:
# Download the rabbitmq-c library
hg clone http://hg.rabbitmq.com/rabbitmq-c/rev/3c549bb09c16 rabbitmq-c
cd rabbitmq-c
# Add the codegen requirement
hg clone http://hg.rabbitmq.com/rabbitmq-codegen/rev/f8b34141e6cb codegen
# Configure, compile and install
autoreconf -i && ./configure && make && sudo make install
And actually on the console I can see that it was "installed" without any problems. But when I try to open any AMQP Connection I get this error:
Fatal error: Class 'AMQPConnection' not found
Actually if I use the phpinfo(); command I can't see anything related to an AMQP module (like in this question). So I think that it may be a problem with the installation but I tried reinstalling it two times and it keeps saying that everything went well.
Have anyone crossed with this problem too?
Solved it..
The module wasn't being loaded in the right php.ini file. Just added extension=amqp.so at the end of the right php.ini file and restarted Apache.

Categories