How to install PHP .rar package? - php

I'm new in installing packages on server. On php.net it says how you can install rar package by hand (http://www.php.net/manual/en/rar.installation.php):
gunzip rar-xxx.tgz
tar -xvf rar-xxx.tar
cd rar-xxx
phpize
./configure && make && make install
I've downloaded the package and uploaded it to server. My question is, WHERE do I need to write the installation commands? I've tried in CMD but, of course, it doesn't work. Help? :)

You need SSH access to the Linux machine you want to install this on. By the sound of your comments you either don't have SSH access (shared hosts) or don't know how to use it.
If you have SSH access to the server you're working on use a program like PuTTY to establish an SSH connection to the server. Once you've logged in with your SSH credentials type these commands:
cd /tmp
wget http://pecl.php.net/get/rar-3.0.1.tgz
gunzip rar-3.0.1.tgz
tar -xvf rar-3.0.1.tar
cd rar-3.0.1
phpize
./configure && make && make install

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

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

phpize not a directory -- heroku zlib install

I'm trying to allow my heroku wordpress install to be able to write files heroku. To do this, I'm trying to install zlib. Fortunately, I got referred to a section of the tutorial on this, but I'm having some trouble. The tutorial tells me to run the following in heroku bash :
heroku run bash
export PS1="\u#\h \w> "
mkdir tmp
cd tmp
git clone https://github.com/php/php-src.git -b PHP-5.3
cd php-src
cd ext/zlib
/app/php/bin/phpize
./configure –with-php-config=/app/php/bin/php-config
make
cd modules
scp zlib.so user#host:~/destination
exit
I'm stuck at
cd ext/zlib
/app/php/bin/phpize
./configure –with-php-config=/app/php/bin/php-config
I'm presuming he means to cd to /ext/zlib/app/php/bin/phpize
I can cd all the way to /bin, but I can't seem to cd to phpize. if I type "dir", I do see something called phpize in the terminal.
What would I need to run to execute the command above? Knowing that I'm currently on the directory /ext/zlib/app/php/bin
phpize is a utility program. Install php-devel

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