That's much the question. I have PHP 5.2.9 on Apache and I cannot upgrade PHP. Is there a way for me to enable SOAP in PHP 5.2.9? The PHP manual did not help at all when it said, "To enable SOAP support, configure PHP with --enable-soap ." How do I configure?
Getting SOAP working usually does not require compiling PHP from source. I would recommend trying that only as a last option.
For good measure, check to see what your phpinfo says, if anything, about SOAP extensions:
$ php -i | grep -i soap
to ensure that it is the PHP extension that is missing.
Assuming you do not see anything about SOAP in the phpinfo, see what PHP SOAP packages might be available to you.
In Ubuntu/Debian you can search with:
$ apt-cache search php | grep -i soap
or in RHEL/Fedora you can search with:
$ yum search php | grep -i soap
There are usually two PHP SOAP packages available to you, usually php-soap and php-nusoap. php-soap is typically what you get with configuring PHP with --enable-soap.
In Ubuntu/Debian you can install with:
$ sudo apt-get install php-soap
Or in RHEL/Fedora you can install with:
$ sudo yum install php-soap
After the installation, you might need to place an ini file and restart Apache.
In case that you have Ubuntu in your machine, the following steps will help you:
Check first in your php testing file if you have soap (client / server)or not by using phpinfo(); and check results in the browser.
In case that you have it, it will seems like the following image ( If not go to step 2 ):
Open your terminal and paste: sudo apt-get install php-soap.
Restart your apache2 server in terminal : service apache2 restart.
To check use your php test file again to be seems like mine in step 1.
As far as your question goes: no, if activating from .ini is not enough and you can't upgrade PHP, there's not much you can do. Some modules, but not all, can be added without recompilation (zypper install php5-soap, yum install php-soap). If it is not enough, try installing some PEAR class for interpreted SOAP support (NuSOAP, etc.).
In general, the double-dash --switches are designed to be used when recompiling PHP from scratch.
You would download the PHP source package (as a compressed .tgz tarball, say), expand it somewhere and then, e.g. under Linux, run the configure script
./configure --prefix ...
The configure command used by your PHP may be shown with phpinfo(). Repeating it identical should give you an exact copy of the PHP you now have installed. Adding --enable-soap will then enable SOAP in addition to everything else.
That said, if you aren't familiar with PHP recompilation, don't do it. It also requires several ancillary libraries that you might, or might not, have available - freetype, gd, libjpeg, XML, expat, and so on and so forth (it's not enough they are installed; they must be a developer version, i.e. with headers and so on; in most distributions, having libjpeg installed might not be enough, and you might need libjpeg-dev also).
I have to keep a separate virtual machine with everything installed for my recompilation purposes.
Related
How is it that php-ast is listed in phpinfo() but not when running $ php -m to list modules?
Working on installing phan, the static analyzer. I use MAMP Pro and have verified that $ which php returns the desired php version within MAMP. I have updated the php.ini file, and running phpinfo() displays AST as expected.
When I run vendor/bin/phan without the flag, I still get the warning that AST should be installed.
I have run it once with the flag to use the polypill parser, and phan works as expected.
Getting started with Phan (see also README for slightly different
instructions): https://github.com/phan/phan/wiki/Getting-Started
PHP-AST Project: https://github.com/nikic/php-ast#installation
Changing PHP: https://gist.github.com/irazasyed/5987693
Install autoconf to overcome related problem:
https://gist.github.com/anunay/7698181
Note: Answers elsewhere using --with-config-file-path don't seem to be working for me as I get a list of valid PHP console commands and it is not one of them: PHP module is shown in phpinfo(), but not php -m
My best guess is that you need to install the ast extension first.
What I did is this
Install PEAR following the instructions in this post
It's basically two commands
curl -O https://pear.php.net/go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar
Note that I have updated the URL to use https
I've simply acknowledged the default config during installation of PEAR, hoping that it will not disturb MAMP in normal operation to have some extra directories.
Download ast from pecl.php.net, since I couldn't make pecl install ast work, maybe it works for you. Then you'll need to run sudo pear install [path-to-downloaded-ast.tgz], replacing the file path with your download location.
Edit php.ini like you already did, adding the extension.
Result should be this
$ php -m
[PHP Modules]
ast
...
I need to add curl to my PHP, I read multiple articles which recommended just sudo apt-get install php5-curl
But when I try it I get error as below
Error:
The following packages have unmet dependencies:
dropbox : Depends: python-gtk2 (>= 2.12) but it is not going to be
installed
php5-curl : Depends: php5-common (= 5.4.45-1~dotdeb+6.1) but
5.4.31-1~dotdeb.0 is to be installed
So I go a bit deeper and try to install it manualy, so I basicly download curl from curl website with: wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
and then just unpack it and just ./configure and sudo make and after that sudo make install
Dispite the fact i didnt get any error It also didnt help.
From error I see that I have older version of my PHP than one in repository but I really have no clue what I can do now.
Is here anyone who can help me?
If you're stuck with that version of PHP, you can build the cURL extension yourself and then activate it with PHP. Normally, cURL is compiled into the PHP binary but you can also run it as a dynamic extension.
When you downloaded, compiled, and installed cURL, this installed the curl program and libraries but has nothing to do with PHP.
You can follow these steps to build a cURL PHP extension for your system:
Go to http://php.net/releases and download the source code for the version of PHP you are currently running
Extract to a temporary location
From the command line, cd to php-5.x.x/ext/curl
Run the following commands:
phpize
./configure --with-curl=/usr/local (/usr/local should be correct, but you can try leaving it blank, or specify the --prefix you used when you installed cURL.
make && make install
After make install runs, it should say something like:
Installing shared extensions: /usr/lib/php5/20121212/
This is where it will place curl.so
Now, edit your php.ini file that PHP uses and add:
extension=curl.so
Restart your webserver &/or PHP, check that cURL is loaded.
Note: If you don't have the phpize (it should have come with PHP) you might need to just build PHP to a temporary location and copy phpize to /usr/bin so you have it.
Hope that helps.
You need to update your PHP version and then install curl.
Do apt-get update to get the latest definitions, then apt-get upgrade to upgrade all packages, then apt-get install php5-curl.
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
I need to specify a directory when compiling php with --with-curl=
The curl binary is located at /usr/bin/curl
curl -V gives me
curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
locate curl gives me
/usr/bin/curl
/usr/lib/libcurl.so.3
/usr/lib/libcurl.so.3.0.0
/usr/lib64/libcurl.so.3
/usr/lib64/libcurl.so.3.0.0
removed /usr/share/... and other irrelevant files
UPDATE
Tried --with-curl=/usr/lib64 and --with-curl=/usr/lib although I'm pretty sure it's 64 bit.
checking for cURL support... yes
checking if we should use cURL for url streams... no
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
SOLUTION
PHP requires curl-devel
None of these will allow you to compile PHP with cURL enabled.
In order to compile with cURL, you need libcurl header files (.h files). They are usually found in /usr/include/curl. They generally are bundled in a separate development package.
Per example, to install libcurl in Ubuntu:
sudo apt-get install libcurl4-gnutls-dev
Or CentOS:
sudo yum install curl-devel
Then you can just do:
./configure --with-curl # other options...
If you compile cURL manually, you can specify the path to the files without the lib or include suffix. (e.g.: /usr/local if cURL headers are in /usr/local/include/curl).
For Ubuntu 17.0 +
Adding to #netcoder answer above,
If you are using Ubuntu 17+, installing libcurl header files is half of the solution. The installation path in ubuntu 17.0+ is different than the installation path in older Ubuntu version. After installing libcurl, you will still get the "cURL not found" error. You need to perform one extra step (as suggested by #minhajul in the OP comment section).
Add a symlink in /usr/include of the cURL installation folder (cURL installation path in Ubuntu 17.0.4 is /usr/include/x86_64-linux-gnu/curl).
My server was running Ubuntu 17.0.4, the commands to enable cURL support were
sudo apt-get install libcurl4-gnutls-dev
Then create a link to cURL installation
cd /usr/include
sudo ln -s x86_64-linux-gnu/curl
Try just --with-curl, without specifying a location, and see if it'll find it by itself.
If you're going to compile a 64bit version(x86_64) of php use: /usr/lib64/
For architectures (i386 ... i686) use /usr/lib/
I recommend compiling php to the same architecture as apache. As you're using a 64bit linux i asume your apache is also compiled for x86_64.
php curl lib is just a wrapper of cUrl, so, first of all, you should install cUrl.
Download the cUrl source to your linux server. Then, use the follow commands to install:
tar zxvf cUrl_src_taz
cd cUrl_src_taz
./configure --prefix=/curl/install/home
make
make test (optional)
make install
ln -s /curl/install/home/bin/curl-config /usr/bin/curl-config
Then, copy the head files in the "/curl/install/home/include/" to "/usr/local/include". After all above steps done, the php curl extension configuration could find the original curl, and you can use the standard php extension method to install php curl.
Hope it helps you, :)
I am running Fedora Core 10 with php 5.2.9 without ldap. Now i want to remove current php installation and recompile the latest version of php with ldap and install it.
How to do this?
Basically, download the sources from the PHP website. Then, from a terminal, type './configure --prefix=/usr/local/my_php_version'
In the output, checks if it recognize your LDAP installation (and also the Apache one). If not, take a look at the configuration options to learn how to specify the paths. Something like '--with-openldap', '--with apxs', etc.
You should also take a look at the configuration options to active the features you need.
Once you're done, type 'make', then 'sudo make install'.
Also take a look at the official install documentation: http://www.php.net/manual/en/install.unix.php
Instead of re-compiling the PHP, you can add the LDAP support to the PHP you have installed.
You can install a variety of libraries and modules without recompiling PHP. To see the libraries that are available, you can execute
yum search php-
To install LDAP for your PHP, you can execute
yum install php-ldap
If you have PHP as an Apache module, you must restart the httpd to activate the changes
service httpd restart