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
Related
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
Documenting my struggles to help others and hopefully get some feedback on how I could have done it better.
The command pecl install pthreads fails due to the php installed on my ubuntu 13.04 box not having zts configured.
Options:
1) The ubuntu respository does not have a php package with zts enabled. As of this post, ubuntu only has php 5.4.9 in it's repository (Released: 22 Nov 2012). It is possible to compile a php version from source - which I eventually did (see below), but..
2) I .. ALSO .. wanted to use phpfarm for the ability to run different versions of PHP on my local setup. On github, there is Christian Weiske's original contribution here (phpfarm) and a fork that he has contributed to, by François Poirotte - also called phpfarm. Francois' fork has a few more options to configure ('post-install customization') but I was not able to make that work with a PECL extension. I'm curious to know if misunderstood how to do that, because it looks to me that it just simply does not take PECL commands.
3). Prior to recompiling php from source, I loaded phpfarm (tried both versions), enabled php-fpm (FastCGI) and was able to get my apache2 server to use a phpfarm version (5.5.10) which showed up in a phpinfo() output. But the php-cli always showed the original php version (5.4.9) in the cli (run: php -v). Running (run: php -i | grep php.ini) showed /etc/php5/cli but I had previously removed php5 and aptitude show php5 returned a state of 'not installed.' I even renamed the /etc/php5 directory to see if I could force the system to use the phpfarm php version. Obviously, this is incorrect thinking and I went on to simply compile php 5.6 from source. But, is there something more to do to get a phpfarm php to be used in the cli? I read that the cli loads it's configuration file on a per command basis, unlike the apache2. If I could have run the 5.5.10 version (configured with zts) then I could have then done pecl install pthreads and then re-complied the phpfarm 5.5.10 version with pthreads enabled. Although it appears I will be able to run various versions of php in the apache server, will I ever be able to switch-phpfarm to another version and see it working in the php-cli? Also, I was uncertain on where I could have loaded a pthreads file for the phpfarm compile process to find and use it; could I have done it that way?
4) This stackoverflow post, essentially posted by Joe Watkins - the developer of pThreads is a perfect how-to on getting pThreads installed on a Ubuntu system that has had php configured with zts (Zend Thread Safety). (Thanks Joe!)
A nice tutorial on using phpfarm configured with fast-cgi and the apache server to help run websites under different php configurations.
So what gives with php, php-cli and the phpfarm?
I'm not sure about phpfarm, but do know of another solution ...
Multi
A tool for maintaining multiple installations of PHP in multiple configurations
https://github.com/datingvip/multi
This is a bit more user orientated, will allow you to build many configurations and versions of php, any tagged release of php, and any patched version from any fork of php-src.
In addition, because I wrote it, it will install pthreads for you.
git clone https://github.com/datingvip/multi
cd multi
VERSION=5.5.10 DBG=no-debug ZTS=zts ./php.multi
The above commands will yield an installation of PHP (in one suitable configuration, of one version) in /opt/php.
Look at php.defaults for configuration options and adjust before building
Should configuration fail on, for example, something related to a library like libxml2, it will usually be the case that
sudo apt-get install library-dev
Where library is replaced with the name of the library holding up the build, will fix the problem for you. If it does not, a quick google should get you going again.
Once the build is complete
source /path/to/multi/php.env 5.5.10
Note: multi will always install pthreads for any zts version automatically
I hope that gets you somewhere ...
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
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.
By default, RHEL5.x64 comes with 5.1.6 - pretty old. I'm looking for a more up to date version, 5.2.8, or even the latest 5.2.9 (as of March 2009). Ideally, a Yum/RPM-based solution, for transparent upgrades (when I plan).
How do you upgrade the default for an up-to-date version?
Oracle have some up-to-date PHP RPMs, but not in a repository that I can see. You could try asking Christopher Jones if he would be interested in building repository metadata for them?
There are also versions in the CentOS testing repository, and Remi Collet has PHP 5.2.9 in his repository (read his announcement).
you could also install a fedora RPM package for PHP in redhat enterprise. RHEL5 rpm packages are like fedora core 6 packages. something like this.
I have installed many Fedora Core 6 RPM packages on RHEL 5 without any problems.
I suggest getting the spec file for the Red Hat PHP rpm, then use that to create your own RPM, in your own local repo, and use that. This way you get the benefits of the newest PHP, configured to be as compatible as possible with your system, and when using YUM for other things, that require PHP, they will be satisfied with your install.
I've elected to go for the Zend-CE solution, installed with YUM (default on rhel5). It's not perfect, the admin-dashboard security leaves something to be desired, and enabling it to be used for php-cli needs at least a manual removale of the old php-cli package + a symlink to the new, but otherwise, its not complicated.
please look at:
http://bluhaloit.wordpress.com/2008/03/13/installing-php-52x-on-redhat-es5-centos-5-etc/
it'll up2date your php for 5.3
[]'