Where would be web_sockets equivalent in Linux? - php

The thing is I have here a group of web developers and everyone works with WAMP in Windows. In there they work with a php extension called php_websockets. Basically in php.ini they just uncomment ;php_websockets.dll and voila.
On the other hand I work with Linux (CentOS 7 in this case), and there's no possible way I can find php_websockets in any php.ini or conf archives.
I know there are a lot of web sockets out there. But they insist me it must be this one.

Not sure if there are multiple "php websockets" projects out there; finding out the version number of the one they are using might help. Assuming it's this one: http://sourceforge.net/projects/phpwebsockets/, there are linux installation instructions at http://sourceforge.net/projects/phpwebsockets/files/:
LINUX INSTALLATION - Tested and works on the following systems:
- Fedora Core 17 PHP-5.4.9 x86_64
- Fedora Core 18 PHP-5.4.10 x86_64
- Fedora Core 18 PHP-5.4.12 x86_64
Build it from source - Simply unpack the files and at a shell prompt type these commands.
# phpize
# ./configure --enable-websockets
# make
# make install
# cp websockets.ini /etc/php.d/
If all went smoothly, websockets should be installed and working.
If you have any issues, please post them in the sourceforge ticket system
https://sourceforge.net/p/phpwebsockets/tickets/
NOTE: You will have to re-build if you update PHP

Related

Download and install the php mcrypt extension under windows 10

where can I download and how to install the mcrypt extension for php 7.1 (TS,VC14) under Windows 10 / 64 bit.
I need it for an akeneo project and this has dependencies using mcrypt (and not other extensions).
I haven't found the right extension dll for it.
Thanks for help.
This example is for PHP 7.4 installed by WAMP in Windows 10 (It will work for others versions if you manage to find the php_mcrypt.dll file for PHP version that you need).
Go to: https://windows.php.net/downloads/pecl/releases/mcrypt/1.0.3/php_mcrypt-1.0.3-7.4-ts-vc15-x64.zip
unpack and copy php_mcrypt.dll to C:\wamp64\bin\php\php7.4.0\ext
Include following lines in C:\wamp64\bin\php\php7.4.0\php.ini and C:\wamp64\bin\apache\apache2.4.41\bin\php.ini:
[mcrypt]
extension=php_mcrypt.dll
Restart Apache server
For other PHP versions you may find the php_mcrypt.dll file in https://pecl.php.net/package/mcrypt or in php windows binaries file: in PHP windows binaries files in ext/ folder https://windows.php.net/downloads/releases/
If you need this code run and it uses mcrypt I doubt if it really requires php 7.1
What might help you (however might not be recommended)
Install Wamp for windows link where you can easily switch between PHP 5 and 7
Wamp isn't ideal for custom php versions but I managed to add some "my-versions" if I did not find interesting ones on the list, you can switch versions by click on the icon at the icon try. left or right (check both ways)
check this link also
Much better in customizing your PHP would be Docker but it requires some learning curve instead of clickable Wamp. However with Docker you can do whatever possible to PHP where with Wamp you'll be always having some obstacles (mainly because of lack of resources how to do something, and specific Windows platform).
If you give up with Wamp, install Docker and run command:
docker run --rm -it php:5-apache php -r 'print_r(get_loaded_extensions());'
to check loaded extensions on php 7 with apache run
docker run --rm -it php:7-apache php -r 'print_r(get_loaded_extensions());'
to see if the php version has mcrypt installed and if not then installing it to docker image of php should't be a big deal (let know in comment if you need info bout that)
Here you have an official PHP image for Docker with description how to install extensions Dockerhub PHP image
Maybe this will help mcrypt-module-open
Best solutions is to install Linux. use a VM or the Windows Subsystem for Linux.
https://learn.microsoft.com/en-us/windows/wsl/install-win10

PHP Library oci8.so without root rights

First off I am not sure if I am at the right place or better at serverfault.
I am working on a PHP project and need access to an Oracle 10g DB. The server I am using is provided and maintained from a 3rd party. Lets call them ABC. I have only a restricted user. So everytime I need something I have to ask them to install it. This worked fine until now.
The server is a RedHat server and ABC is only allowed to install software from the official repositories. We were able to install the Oracle Instant Client but did not find the PHP libraries within the repository.
Our second try was to find a rpm-package containing the OCI8 library which is compatible with the installed software. Unfortunatly we only found a version which needs a newer PHP version which, you guessed it, is not part of the official repository.
Okay, I checken php.net and they told me that I would be able to compile it myself as a shared library. Neat, that would be enough. The problem here is that i am not able to run the phpize command as locking failes (in terms of blocks) the process. The root-User from ABC would be able to do it, but they are not allowed to compile anything.
So here I am asking you guys if there is a way to download the files and use it as a shared library without installing, compiling or whetever. The server is a 64bit RedHat Enterprise 6:
Linux [SERVERNAME] 2.6.32-358.11.1.el6.x86_64 #1 SMP Wed May 15 10:48:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
Any help is highly appreciated!
Thanks,
Alex
I found a way:
1. Set a proxy for pear:
pear config-set http_proxy http://[proxy]:[port]
2. Get sudo rights to use pecl
3. Install:
sudo pecl install oci8

How to configure PHP builid

I'm attempting to add the gettext() extension to the PHP build, the installation instructions are not very clear:
To include GNU gettext support in your PHP build you
must add the option --with-gettext[=DIR] where DIR is the
gettext install directory, defaults to /usr/local.
Where do i place this option, and in which file? (I have never configured PHP before)
Is Apache restart required? If so, how long does it take and what are the dangers?
I have not installed gettext myself, it looks to be preinstalled on my system:
# rpm -qi gettext
Name : gettext Relocations: (not relocatable)
Version : 0.17 Vendor: CentOS
Release : 16.el6 Build Date: Thu 11 Nov 2010 04:06:25 AM EST
Install Date: Tue 30 Jul 2013 03:03:04 PM EDT
The gettext extension is installed by default, but not its PHP bindings. Install package php-gettext to add those to your system. The package manager will handle all other bindings for you, and probably even restart Apache for you. On a normal system in a normal situation that takes less than a second, and your users won't notice anything since Apache gracefully waits for existing requests to finish when shutting down.
Ignore the install notes in the PHP manual when not running a self-compiled version of PHP - on systems like Debian, Ubuntu, CentOS etc. the package manager will handle most common tasks like this for you in a safer way.
The comment in the instructions is directed towards compiling from source.
Like Niels wrote, package manager should do the job and take care of all missing dependencies. Since your system is CentOS try this:
yum install php-gettext
I come to this question with the php-build tool. In case to compile with php-build tool and would like to add the custom configuration, you can configure it in /usr/local/share/php-build. (Ubuntu), it may in another directory up to your platform.
Go there and edit file default_configure_options and put any custom configurations as you wishes.
ex.
--with-gettext=/usr/bin

How to install amqp on windows

I am having this error while installing pecl/amqp
when I type in the command line: pear install pecl/amqp
WARNING: php_bin C:\xampp\php.\php.exe appears to have a suffix .\php.exe,
but
config variable php_suffix does not match
ERROR: The DSP amqp.dsp does not exist.
I need to install this so that I can use amqp (RabbitMQ) on php.
# AMQP installation php.net:
Note to Windows users: This extension does not currently support Windows since the librabbitmq library does not yet support Windows.
But here at RabbitMQ website is a windows installer...
Apparently the information on the php.net page is outdated
To install do like this:
Download the correct package for your php from this official PECL amqp page
unzip
add php_amqp.dll to your php ext folder and enable the extension inside your php.ini file: extension=php_amqp.dll
add rabbitmq.#.dll to your windows system 32 folder (where # corresponds with the version number).
All this according to the post on the blog I found here.
UPDATE
I updated some of the information above. The blog post is from 2013, and only mentioning older versions, but it is anyway a nice guide to the steps you need to take. Since then newer versions are available so be aware there are some slight differences in the process (mainly version numbers) if you want to install a newer version.
This works for me in PHP 7.1, and amqp 1.9.4 for Windows.
Download the correct package in https://pecl.php.net/package/amqp based on your PHP version, architecture, thread safety, and compiler. You can check it in phpinfo
Copy php_amqp.dll to your php ext folder
Update your php.ini with: extension=php_amqp.dll
Copy rabbitmq.4.dll to your windows system 32 folder if 32bit system. add it to SysWOW64 if using 64bit system.
Restart apache.
On Windows 10, build 19041 (2004 update), 64-bit.
Using Xampp with PHP 7.4.8.
Go to here and download your relevant version: https://pecl.php.net/package/amqp (check which version you need in CLI using php -v)
From the .zip, copy the rabbitmq.#.dll to C:/Windows/System32
From the .zip, copy the php_amqp.dll to C:/xampp/php/ext (or simply your php/ext folder if using something else than Xampp)
If you've got PHP running as a service with Apache, restart Apache. If you're using it via CLI (e.g. via Bash and/or Symfony CLI server) then you're already good to go.
Other posts mention the 64-bit variant to have the rabbitmq.#.dll (where # is the version) to go in C:/Windows/SysWOW64. I tried that, didn't work for me, even though running 64-bit Windows and PHP.
$ php -v
PHP 7.4.8 (cli) (built: Jul 9 2020 11:30:39) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Although this will not answer how to install RabbitMQ with the pear install pecl/amqp, but have you ever tried to use rabbitmq with the pure php implementation php-amqplib?
After many hours of search: To install amqp to php7.4 & Windows 10 (https://pecl.php.net/package/amqp),
Choose the good file (x86,x64,ts,nts)
php -i or phpinfo() (Architecture => x64)
php -i|findstr "Thread" (ts or nts enable)
Copy rabbitmq.4.dll and rabbitmq.4.pdb files to PHP root folder php_amqp.dll and php_amqp.pdb files to PHP\ext folder
Add extension=amqp to the php.ini file
check php -m if you show amqp (php -v to show errors)
Big thank's to Rezende (tutorial)
If you are on Windows, on this Url you can download the installable rabbitmq and here is the direct download link for RabbitMQ 3.9.11.
You can also use choco to install it using:
choco install rabbitmq
And since, rabbitmq is implemented/written in erlang you also need erlang to be able to install rabbitmq and its services. Make sure you download erlang and install it.

How do I upgrade PHP in Mac OS X?

I feel this is an awfully obtuse question to ask, but strangely, this problem is poorly documented.
I would like to upgrade PHP, but there are several problems:
There is no built-in package manager. MacPorts doesn't recognize php as an installed package because it didn't install PHP itself.
Running locate php indicates there are probably many dependencies.
I don't know HOW php was installed, as it was included with the OS, so I don't know whether I should install from source or download binaries. I also don't know the proper way to uninstall the previous version without breaking dependencies.
I am running on Leopard. I have a feeling Apple doesn't want you to upgrade. Would buying Snow Leopard and upgrade solve this problem (and future ones like it)?
You may want to check out Marc Liyanage's PHP package. It comes in a nice Mac OS X installer package that you can double-click. He keeps it pretty up to date.
http://php-osx.liip.ch/
Also, although upgrading to Snow Leopard won't help you do PHP updates in the future, it will probably give you a newer version of PHP. I'm running OS X 10.6.2 and it has PHP 5.3.0.
I use this: https://github.com/Homebrew/homebrew-php
The command is:
$ xcode-select --install
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
$ brew options php56
$ brew install php56
Then config in your .bash_profile or .bashrc
# Homebrew PHP CLI
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
I think one simple way to do it, is:
1 - Check you where is your current PHP:
$ which php
$ /usr/local/bin/php
You see? Usually, our commands that we run is a link in /usr/local/bin so...
2 - Unlink this current link of PHP
unlink /usr/local/bin/php
If you prefere, before unlink it, check the path and then remove php files (do ls -al /usr/local/bin | grep php and then rm -rf into desired path)
3 - Install PHP 7.1
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
4 - Create new link (using php 7.1 bin that you have installed)
ln /usr/local/php5-7.1.9-20170914-100859/bin/php /usr/local/bin/php
Like I said, its a simple way I think.
There is no built-in package manager. MacPorts doesn't recognize php as an installed package because it didn't install PHP itself.
You could still install it with MacPorts. sudo port install php52 (or whichever version you want) will install PHP.
It won't overwrite the Apple-supplied version. It'll install it under /opt/local. You can add /opt/local to the beginning of your $PATH, and use the MacPorts version in your Apache config.
Option #1
As recommended here, this site provides a convenient, up-to-date one liner.
This doesn't overwrite the base version of PHP on your system, but instead installs it cleanly in /usr/local/php5.
Option #2
My preferred method is to just install via Homebrew.
Before I go on, I have the latest version (v5.0.15) of OS X Server (yes, horrible, I know...however, the web server seems to work A-OK). I searched high and low for days trying to update (or at least get Apache to point to) a new version of PHP. My mcrypt did not work, along with other extensions and I installed and reinstalled PHP countless times from http://php-osx.liip.ch/ and other tutorials until I finally noticed a tid-bit of information written in a comment in one of the many different .conf files OS X Server keeps which was that OS X Server loads it's own custom .conf file before it loads the Apache httpd.conf (located at /etc/apache2/httpd.conf). The server file is located:
/Library/Server/Web/Config/apache2/httpd_server_app.conf
When you open this file, you have to comment out this line like so:
#LoadModule php5_module libexec/apache2/libphp5.so
Then add in the correct path (which should already be installed if you have installed via the http://php-osx.liip.ch/ link):
LoadModule php5_module /usr/local/php5/libphp5.so
After this modification, my PHP finally loaded the correct PHP installation. That being said, if things go wonky, it may be because OS X is made to work off the native installation of PHP at the time of OS X installation. To revert, just undo the change above.
Anyway, hopefully this is helpful for anyone else spending countless hours on this.
Upgrading to Snow Leopard won't solve the your primary problem of keeping PHP up to date. Apple doesn't always keep the third party software that it bundles up to date with OS updates. And relying on Apple to get you the bug fix / security update you need is asking for trouble.
Additionally, I would recommend installing through MacPorts (and doing the config necessary to use it instead of Apple's PHP) rather than try to upgrade the Apple supplied PHP in place. Anything you do to /usr/bin risks being overwritten by some future Apple update.
Saving on keystrokes, this worked on MacOS Sierra:
$ brew install homebrew/php/php71
$ /usr/local/opt/php71/bin/php -v
PHP 7.1.4 (cli) (built: Apr 14 2017 15:02:16) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Check your current php version in terminal with the following command,
$ php -v
You see current php version in terminal, and next command run in terminal if you want to upgrade your php version with php concat with version liked as,
$ brew install homebrew/php/php71
Please restart terminal if you finished php version upgrade installed and run the command.
$ php -v
Now you see the current php version in terminal....thank
Use this Command:
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
You can use curl to update php version.
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.3
Last Step:
export PATH=/usr/local/php5/bin:$PATH
Check the upgraded version
php -v
best way to upgrade is
compile it from source
see this tutorial that may be helful for you
http://www.computersnyou.com/2012/09/how-to-upgrade-php-in-mac-osx-compiling.html
to upgrade php7 to latest stable version brew upgrade php7
or for php5.X to latest stable version
brew upgrade php56
use brew list to check installed version

Categories