V8js installed but not working - php

Good morning,
I tried to install V8js from this link
https://github.com/linux-on-ibm-z/docs/wiki/Building-V8-libraries-5.xi
I have add the path in php.ini
extension = /root/v8test/v8/out/s390x.release/lib.target/libv8.so
I have also try with https://github.com/phpv8/v8js/blob/php7/README.Linux.md the first method and the last method
cd /tmp
git clone https://github.com/phpv8/v8js.git
cd v8js
phpize
./configure --with-v8js=/opt/v8
make
make test
sudo make install
And add extension=v8js.so to php.ini
Then I restart apache and in my phpInfo I don't see V8Js.
It is the good php.ini because when I change the Default timezone in this file, it works.
I don't see what I am missing I am under linux Mint with php7
Thanks

The error was that after :
cd /tmp
git clone https://github.com/phpv8/v8js.git
cd v8js
phpize
./configure --with-v8js=/opt/v8
make
make test
sudo make install
I had to copy v8js.so into the folder /usr/lib/php/20151012
sudo cp /tmp/v8js/modules/v8js.so /usr/lib/php/20151012/
The name of the folder can be find in phpinfo at line extension_dir. error can be view in the file /var/log/apache2/error.log

Related

How to add imagick extension to xamppfiles Mac M1

I am attempting to install imagick and use it on my php project via xampp on Mac M1, i manage to install it using below steps
git clone https://github.com/Imagick/imagick
cd imagick
phpize && ./configure
make
sudo make install
And got the path of the imagick.so after building.
/bin/sh /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/libtool --mode=install cp ./imagick.la /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules
cp ./.libs/imagick.so /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so
cp ./.libs/imagick.lai /Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.la
Now i am trying to add it on my php.ini file using below methods
extension="imagick.so"
and
extension="/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so"
and
extension=/Applications/XAMPP/xamppfiles/htdocs/imagick/imagick/modules/imagick.so
after restarting the xampp and tried none of it worked, meaning it does not appear on my phpinfo modules and cannot instantiate new Imagick(); any advice

Where is php7 bin? PHP

I'm trying to install a PHP Extension on my Linux Server however the installation process is confusing.
They provide this instructions.
git clone https://github.com/longxinH/xhprof.git ./xhprof
cd xhprof/extension/
/path/to/php7/bin/phpize
./configure --with-php-config=/path/to/php7/bin/php-config
make && sudo make install
I done git clone on PHP Extensions Folder
The thing that confuse me is
/path/to/php7/bin/phpize
Where is php7 bin?
The closest thing i found is /usr/bin/php
but its an executable file.
Inside this directory
/usr/bin/
I have php , php7.4, php-config, phpconfig7.4

Trying to upgrade SQLite on Amazon EC2

I need SQLite minimum version 3.8 to support a MediaWiki install on Amazon EC2. Amazon Linux is based on CentOS and the latest version available in the yum repository is SQLite 3.7.17.
The downloads available from sqlite.org don't include 64-bit Linux. There is a GitHub repository that has a prebuilt 64-bit version, however it's only the command line version. I put it at /usr/bin:
$ which sqlite3
/usr/bin/sqlite3
$ sqlite3 --version
sqlite3: /lib64/libtinfo.so.5: no version information available (required by sqlite3)
3.26.0 2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9
But MediaWiki still complains I have SQLite 3.7.17 installed. When I test it I get:
$ cat x.php
<?php
print_r(SQLite3::version());
?>
Run it:
$ php7 x.php
Array
(
[versionString] => 3.7.17
[versionNumber] => 3007017
)
I am guessing this is because of these libraries:
$ sudo find / -name "libsqlite*"
/usr/lib64/libsqlite3.so.0
/usr/lib64/libsqlite3.so.0.8.6
How can I download/rebuild or otherwise install a later version of these SQLite libraries?
The easiest option I found was to build it myself. Tested on Amazon Linux release 2 (Karoo).
Download the latest source code with the configure script from here. Currently this is:
curl https://www.sqlite.org/2020/sqlite-autoconf-3320300.tar.gz | tar xzf -
Go into the created directory and create the Makefile with our system dependant options:
cd ./sqlite-autoconf-3320300 && ./configure
Build the binary
make
Install it
sudo make install
Clean up
cd .. && rm -r ./sqlite-autoconf-3320300
Note: It's far from ideal to do this without a proper RPM package. If you update sqlite through yum, you will overwrite you manually built version.
Adding on to #halbgut answer, with some changes:
Download the latest source code with the configure script from here. Currently this is:
curl https://www.sqlite.org/2020/sqlite-autoconf-3320300.tar.gz | tar xzf -
Go into the created directory and create the Makefile with our system dependent options:
cd ./sqlite-autoconf-3320300 && ./configure
Build the binary
make
Install it
sudo make install
Now, you have created the sqlite3 file. You need to replace them everywhere you find the file sqlite3.
To find all these places - run the following command:
whereis sqlite3
sqlite3: /usr/bin/sqlite3 /usr/local/bin/sqlite3 /usr/include/sqlite3.h /opt/c9/bin/sqlite3 /usr/share/man/man1/sqlite3.1.gz
Now within the sqlite source folder ./sqlite-autoconf-3320300, find the sqlite3, sqlite3.h files and replace with the following cp command
sudo cp sqlite-autoconf-3320300/sqlite3 /usr/local/bin/sqlite3
sudo cp sqlite-autoconf-3320300/sqlite3 /usr/local/bin/sqlite3
sudo cp sqlite-autoconf-3320300/sqlite3 /opt/c9/bin/sqlite3 {I am using c9, hence this file, figure out what file is in the opt/ dir)
sudo cp sqlite-autoconf-3320300/sqlite3.h /usr/include/sqlite3.h
Once done, you would have upgraded both env and python-env. Now you need to just define the path to it. For it, use the local/lib in usr.
export LD_LIBRARY_PATH="/usr/local/lib"
Now you should have this :
$ python -c "import sqlite3; print(sqlite3.sqlite_version)"
3.23.3
$ sqlite3 --version
3.32.3
If you just need the sqlite3 binary, the SQLite amalgamation also works perfectly on Amazon Linux 2. For SQLite 33.9.04 (or others from the SQLite Download section):
wget "https://www.sqlite.org/2022/sqlite-amalgamation-3390400.zip"
unzip "sqlite-amalgamation-3390400.zip"
cd "sqlite-amalgamation-3390400"
gcc shell.c sqlite3.c -lpthread -ldl -lm -o sqlite3
And then use it as you would any other software compiled from source:
ln -n ./sqlite3 ${wherever}/sqlite3
export PATH="${wherever}:$PATH"
SQLite docs give a good explanation of further options if you need them.
Get the latest sqlite3 download link from https://www.sqlite.org/download.html
and update the link given in the WGET bash command example shown below.
Example:
wget https://www.sqlite.org/2022/sqlite-tools-linux-x86-3400000.zip
unzip sqlite-tools*.zip
cd sqlite-tools*
sudo cp sql* /usr/local/bin/ # Usually this directory is empty, so no need to worry about overwriting files
cd ~
sudo yum update -y
sudo amazon-linux-extras install epel -y
sudo yum install glibc.i686 -y
sqlite3 --version

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