Configuring PHP for pthreads - php

I am trying to install pthreads for PHP, which is here.
In PHP manual of extention it says:
To enable pthreads support, configure PHP with --enable-maintainer-zts
and --enable-pthreads.
I have a CentOS server which has PHP installed but I cant figure out how to reconfigure it with these settings on, I checked my phpinfo() can see current ./configure options.
I will happy if someone can show me how to reconfigure my php. Do I need to uninstall current PHP first then install another or is there any way to run this ./configure command easily. I have SSH access to my server.

You could try install using PECL:
http://pecl.php.net/package/pthreads.
How to install PECL extensions:
http://php.net/manual/en/install.pecl.php
pecl install pthreads

I've written a tutorial about exactly this - Compile PHP with pthreads and ZTS enabled.
You must compile PHP as there are no prebuilt packages.
To reconfigure everything you'd use ./configure mainly.

if centos does not provide a thread safe version, you must compile php by own.

You have to build pthreads for your centos op system. After that you can use it as extension...
Use the following tutorials
http://blog.slowbro.org/2013/08/compiling-php-55-with-pthreads-on-centos/
http://eddmann.com/posts/compiling-php-5-5-with-zts-and-pthreads-support/
Or simply read the manual...
http://www.php.net/manual/en/pthreads.installation.php

Related

How to download PHP -thread safe now that Homebrew no longer support --with-thread-safety?

I need to use PHP pthreads on Mac OS High Sierra, but Homebrew is no longer supporting downloads of PHP --with-thread-safety.
How do I get and install a thread safe version of PHP for Mac OS, Php v7.1.16 without homebrew?
If it is going to have to be some sort of manual install - does anyone have step by step directions for the mac or know where I can get instructions?
I have been looking on the internet for instructions for 5 hours now. I'm tired and can't believe that no one has any posted info on this.
I was able to get PHP 7.2.5 installed on Mac OS HighSierra with ZTS/Thread safety by using phpbrew.
Install Steps I took:
Downloaded phpbrew from http://phpbrew.github.io/phpbrew/ and installed with their directions. Please note at the end of the installation, they give you further instructions for setting up your ~/.bashrc to load phpbrew, look for them at the terminal.
Once you have phpbrew running you are ready to install php with zts by using the command below (of course you can install all of the extensions that you like by checking the installation for extension instruction)
phpbrew install php-7.2.5 +openssl='/usr/local/opt/openssl/' -- --enable-maintainer-zts --with-curl=/usr/local/
It is important to have openssl and curl already installed before installing php and you must point to their location on your computer at the install line as I have done above. You can add all the extensions you need, but you must have the openssl and curl because I had a ton of problems with installation without them. But you could try omitting.
For those of you who are using PHP ZTS so that you can go on to install pthreads --ONLY PHP 7.2 and above works with Krakjoes pthread-master which you can download and follow the installation at https://github.com/krakjoe/pthreads

undefined ssh2 in php with apache on debian

Debian : 7.4
I have some difficulty to make ssh2 work with php5. i didn't find a solution on other topics and i search a LOT ! all has been well installed according to debian outputs but it still doesn't work.
This is what i'v done
Package installed :
- php5
- php5-dev
- libssh2-php
- libssh2-1-dev
I used PECL to install
pecl install -f ssh2
I just press enter for auto prefix.
And extension=ssh2.so to /etc/php5/apache2/php.ini
Restart more than one time apache2.
But the package ssh2 still not appear in output of php -m and says that ssh2_connect is undefined
I totally out of resources to make it works, so please can anybody helps me ?
Here some info provided by phpinfo() :
extension_dir /usr/local/lib/php/extensions/no-debug-non-zts-20100525/
extension version 0.12
libssh2 version 1.4.3
banner SSH-2.0-libssh2_1.4.3
If you need i can give more informations
I use phpseclib's libssh2-compatibility-layer to avoid having to install libssh2. You can use all the libssh2 functions without having it installed thanks to the use of phpseclib.
If you're writing your application from scratch maybe try just using phpseclib from the onset intsead of libssh2.

Normalizer not found in PHP 5.3.8 and NOT xampp

The only help i can find is about XAMPP installations, but i'm running a fresh root server with Plesk and.. classical LAMP and PHP 5.3.8 - everyone is telling me that Normalizer class must be available in PHP 5.3+, but it's obviously not available in my server..
what is missing, what i have to do that the class is there and running?
Unless PHP was compiled with the --enable-intl flag, the Normalizer will not be available. Check using phpinfo(). If it's not enabled, you can either recompile PHP, adding that flag, or try the PECL installation.
See http://php.net/manual/en/intl.installation.php
If the PHP installation was provided by the OS, perhaps you can use its package manager to add the intl extension as well. With root privileges, just run something like this:
$ apt-get install php5-intl

How to use Pthreads PHP extension in Ubuntu

I have problems with the Pthreads PHP extension. I have compiled PHP with ZTS enabled (--enable-maintainer-zts) and installed the pthreads via pecl and also tried to manually compile the extension.
It seems I don't actually know how to use it. I assumed I would be able to use the Thread class in PHP like any other built-in class, but with no luck as PHP doesn't recognize it. POSIX functions seem to work.
I am using Ubuntu 12.10 Server 64-bit with mod_php 5.4.6.
If you cannot access the extensions classes then it is not loaded.
I think you opened a bug report, to which I responded that your configure line is malformed.
The configure line you want to use is:
./configure --enable-pthreads --enable-maintainer-zts
The above command will build pthreads as a DSO.
./configure --enable-pthreads=static --enable-maintainer-zts
The above command will build pthreads statically into PHP.
Both are equally supported by 5.3, 5.4 and even 5.5.
Additionally, if you are overwriting your system installation then you should use a specific --prefix, for example, if you php executable is at /usr/bin ( which you can ascertain with "which php" ), then --prefix=/usr will overwrite your system installation.
Clean out your old installations ( do make uninstall if the sources are still available ). Start again, ensure you are either, overwriting the system installation or isolating this one completely.
Please update the bug report when you have worked it out.

can't get odbc working in apache

I installed unixODBC by using apt-get install, and now when I try to use odbc_connect() is still get this error.
PHP Fatal error: Call to undefined function odbc_connect()
what do i need to do to configure it to work with php? I have been looking online but I can't really figure it out.
I think you need to install php5-odbc also. unixODBC provides the driver manager, but you need the PHP code that calls it.
Had the same issue on CentOS 6.3 with PHP 5.3.16. But the fix was to use yum to install php-odbc.
yum install php-odbc
Did you add it to your LD_LIBRARY_PATH? Check the documentation for your server, it may require third-party libraries to be in a specific sub-directory, or have some other mechanism for finding them. If so, you should be able to create a symbolic link to the library. That way, if it gets updated, your server will automatically use it.
We had this problem also. We installed php5-odbc, and still had the problem. Turns out we needed to reboot Linux for php to see the function. Recycling Apache was not enough!
Make sure to enable odbc extension for your Apache by a2enmod odbc.
Then check if exists by: apache2ctl -M.
If you don't have this extension, install via apt-get install php-odbc (use yum in case of CentOS).
See also: Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS.

Categories