php v8js on ubuntu - error v8js class not found - php

I am using ubuntu 14.04 with PHP 5.6 and successfully installed v8js-0.1.3 using sudo pecl install v8js-0.1.3.
I followed this installation process
Installing PHPv8js on Ubuntu.
Which is display when I am using php -m.
But when I call new object of v8js like $v8 = V8Js().
I get the following error :- Fatal error: Class 'V8Js' not found

V8Js is a PHP7 extension for Google's V8 Javascript engine V8 Js.

Related

Apache, PHP 5.6 or 7.0: Library not loaded: openssl/lib/libcrypto.1.0.0.dylib using Homebrew

I am trying to load either PHP 5.6 or PHP 7.0 module in the Apache httpd.conf config file on macOS 10.15 Catalina. But what I receive when starting the Apache server using sudo apachectl start in Terminal is the following error:
httpd: Syntax error on line 187 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so into server: dlopen(/usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so, 10): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n Referenced from: /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so\n Reason: image not found
Since PHP versions 5.6, 7.0 and 7.1 have been deprecated and removed from Homebrew, following this guide, I had to use an older deprecated tap and installed both PHP 5.6 and 7.0 by running:
brew tap exolnet/homebrew-deprecated
brew install php#5.6
brew install php#7.0
For the sake of complete information, I have tried both the Apache which comes with macOS and the latest Apache 2.4.43 installed via Homebrew, but this should not make a difference.
So the question is, how can I solve these errors and make PHP 5.6 and 7.0 running on macOS using Homebrew?
The solution is to install an older version of the openssl library. To be more specific, PHP 5.6 and php 7.0 require openssl 1.0.2, which you can install via Homebrew by running the following in Terminal:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
brew switch openssl 1.0.2t
However, after running the above, when using PHP 5.6, php 7.0 or php 7.1, another "Library not loaded" error might occur., in particular, this one:
httpd: Syntax error on line 183 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so into server: dlopen(/usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so, 10): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib\n Referenced from: /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so\n Reason: image not found
Here, another older library is required, icu4C in this case. The solution is to run the following:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
brew switch icu4c 64.2
Note for switching to PHP 7.2, PHP 7.3 or PHP 7.4
Since PHP 7.2, PHP 7.3 and PHP 7.4 do not work with the above mentioned older, 64.3, version of the icu4c library, whenever you need to switch to these PHP versions, e.g., by using this easy brew PHP switcher script, you also hav to switch the version of the icu4c library by running this command:
brew switch icu4c 67.1
Resources
OpenSSL 1.0.2m on macOS - Stack Overflow.
homebrew-core/openssl.rb at 75b573845a17aaf3f7c84dc58e97cf5fe39a502b ยท Homebrew/homebrew-core.
node.js - dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac - Stack Overflow.
macOS 10.15 Catalina Apache Setup: Multiple PHP Versions | Official home of Grav CMS.

cURL not loading for Ubuntu 16.04.3 with PHP 5.6

I have a Ubuntu 16.04.3 server that when I use phpinfo() I find that the server is using PHP Version 5.6.11 on Apache/2.4.18.
I installed curl and when I run sudo find / -name curl.so\* I get returned
/usr/lib/php/20151012/curl.so
phpinfo() shows the following additional .ini file: /etc/php5/apache2/conf.d/99-curl.ini
The contents of this file are extension=/usr/lib/php/20151012/curl.so
When I run the following on a php page:
var_dump(function_exists('curl_init')); print
I get bool(false)
This occurs even after a sudo service apache2 restart
How do I get CURL to run in my PHP pages?
Most likely, the reason it is not loading is because the API version 20151012 is for PHP 7.0 and not 5.6, so that curl extension module is not compatible with 5.6.
If you do sudo apt-get install php5-curl you should get the right extension which should get installed to /usr/lib/php/20131226.
The Apache error log should have a startup error saying that the module is not compatible and might offer more detail as to why it's not being loaded.

ImageMagick module not available with this PHP installation on Laravel 5.4 with PHP 7

Currently, I have cloned a project. I have PHP 7 on Ubuntu 14.04 64-bit.
The ImageMagick library is installed using the following command
sudo apt-get install php-imagick
But when I try image manipulation through this library, it throws the following exception
(1/1) NotSupportedException
ImageMagick module not available with this PHP installation.
How can I install this software with the latest PHP version?
Note: I am using Laravel 5.4 in this project.
You have to add extension=imagick.so in your php.ini file.
Location:
You can do some thing like this for the fastest way:
php -i | grep 'php.ini'
The result is like that:
Loaded Configuration File => /usr/local/lib/php.ini
Or call <?php phpinfo(); ?> from some php file to get this information :)
PS: Source
I had the same problem on my computer, and what solved it was:
Instead of installing sudo apt install php-imagick, I installed sudo apt install php7.4-imagick (or whatever version your PHP installation is).
This, in combination with Maraboc's answer did the trick for me.

using V8js in your MAC?

My idea is to use reactjs with serverside rendering in PHP. I run and install with success php55-v8js using homebrew. the path of installation is /usr/local/Cellar/php55-v8js/0.4.0_2
in my application I tried to use V8 but with no success. the message displayed is:
Fatal error: Class 'V8Js' not found in
/Applications/AMPPS/www/phpreact/index.php on line 14.
on line 14 the following code is displayed: $v8 = new V8Js();
my main question is: do we have to call v8 through a require_once/file_get_contents->toPath or similar? or homebrew installation make v8 available globally on the OS system?
If you installed the V8 PECL extension correctly, you also need to turn on the extension in your .ini file and restart your PHP server.

mongodb php-driver : php startup error

I installed mongodb php-driver as per the guideline shown here:
https://github.com/mongodb/mongo-php-driver
But when I run #php command its showing following error :
Warning: PHP Startup: Unable to load dynamic library
'/opt/lampp/lib/php/extensions/no-debug-non-zts-20151012/mongodb.so' -
/opt/lampp/lib/php/extensions/no-debug-non-zts-20151012/mongodb.so: symbol
CRYPTO_get_locking_callback, version OPENSSL_1.0.0 not defined in file
libcrypto.so.1.0.0 with link time reference in Unknown on line 0
I am using :
Lampp Stack
PHP : 7.0.0
OS: Ubuntu 15.10
Pear: 1.10.1
Please suggest any solution if you have. Thanks in advance .
It looks like you don't have SSL library enabled/installed correctly on your system. Most likely, I am thinking you don't have the libssl-dev package installed.
You should install this with apt-get install libssl-dev libsasl2-dev, and then reinstall the mongodb extension with pecl uninstall mongodb && pecl install mongodb.

Categories