How to compile PHP with new OpenSSL library - php

I am trying to compile PHP with OpenSSL. That works with the default OpenSSL library 0.9.6 by simply configuring with --with-openssl=/usr.
However, I have installed a new OpenSSL library 1.0.0 which I would like to compile PHP with. This library lives in /usr/local/ssl/bin.
That unfortunately does not work:
configure: error: Cannot find OpenSSL's <evp.h>
How can I compile PHP with the new OpenSSL library?

fixed it by recompiling curl as the compiled version of curl was also using the old openssl lib
sudo ./configure -disable-shared -with-ssl=/usr/local/ssl
After compiling curl, also compiled php again --with-openssl=/usr and phpinfo tells me it is using the new openssl lib.

I had the same problem, but before compiling (./configure -disable-shared -with-ssl=/usr/local/ssl) I removed (yum openssl-devel) and it worked

For those using MacPorts adding ssl is super simple:
$ sudo port install php71-openssl
That's it. Ports will recompile php (version 7.1 in this case) with openssl for you.

Related

PHPBrew - Install php 5.3.2 with openSSL on Ubuntu 18.04

I am trying to install PHP 5.3.2 on Ubuntu 18.04 using PHPBrew. I have no trouble with installing it without OpenSSL but when I want to install OpenSSL I get several errors.
My first attempt was to just use +openssl but then I got a lot of errors from OpenSSL. Then I installed OpenSSL 0.9.8 and used it as +openssl=/usr/local/openssl/ and now I get the following error:
configure: error: Cannot find OpenSSL's libraries
I have no idea what libraries it can't find. I already fixed the missing evp.h file by making a symbolic link in /usr/local/openssl to /usr/local/openssl/include/openssl/evp.h.
Edit: Haven't found a fix yet, just went with the version without OpenSSL.

How do I install PHP with openssl on Mac High Sierra?

I'm using Mac High Sierra. I want to install PHP 7.2 with the openssl extension. I have openssl installed
localhost:php-7.2.1 davea$ brew install openssl
Warning: openssl 1.0.2n is already installed
However, when I run the PHP configure command (I'm building it from source), it eventually dies with the below error
localhost:php-7.2.1 davea$ ./configure --with-gmp=/usr/local --with-openssl --with-openssl-dir=/opt/local/bin
...
checking for Kerberos support... no
checking whether to use system default cipher list instead of hardcoded value... no
checking for RAND_egd... no
checking for pkg-config... /usr/local/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>
How do I tell PHP where that library is or rather how do I install it somewhere on my Mac?
ps - The reason I'm not installing PHP with homebrew is because homebrew does not support installation of PHP with GMP, which I need.

How do I install php-cgi? I tried MacPort, Package and everything else but none works

I am trying to install php-cgi on my macbook (Yosemite 10.9.3) because the PhpStorm IDE keeps coming back to me "php-cgi not found" when i try to open things in browser. I tried to use a newer version of php interpreter because the current version is 5.4. But I can only find the packages in the php.net site but I have no clue how to install it. I also tried to download homebrew but again have no clue how to start there. I tried to use MacPort to install a fastcgi by using this line:
sudo port install php5 +fastcgi
But it returns this:
---> Dependencies to be installed: autoconf213 gawk gettext expat libiconv ncurses readline m4 perl5 perl5.16 gdbm bzip2 gsed libtool libxml2 xz zlib mhash pcre libedit pkgconfig
---> Fetching archive for expat
---> Attempting to fetch expat-2.1.0_0.darwin_13.x86_64.tbz2 from http://packages.macports.org/expat
---> Attempting to fetch expat-2.1.0_0.darwin_13.x86_64.tbz2.rmd160 from http://packages.macports.org/expat
---> Installing expat #2.1.0_0
---> Activating expat #2.1.0_0
Error: org.macports.activate for port expat returned: Image error: /opt/local/bin/xmlwf already exists and does not belong to a registered port. Unable to activate port expat. Use 'port -f activate expat' to force the activation.
Error: Failed to install expat
Please see the log file for port expat for details: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_textproc_expat/expat/main.log
Error: The following dependencies were not installed: autoconf213 gawk gettext expat libiconv ncurses readline m4 perl5 perl5.16 gdbm bzip2 gsed libtool libxml2 xz zlib mhash pcre libedit pkgconfig
To report a bug, follow the instructions in the guide:http://guide.macports.org/#project.tickets
Error: Processing of port php5 failed
I run a self-update with the MacPort already (version 2.3.0). Can anyone help out? Thank you so much!
P.S. For PhpStorm, I am forced to use the built-in web server when i try to view the code in the browser. If anyone got a way to do that without their built-in server, that would be great too. I have a zend server installed already.
P.S. I am using NetBeans now. But I guess it is good to make sure I get things like this settled while I am working on other things.
It took me a few tries to get PhpStorm setup with MacPorts. These are the basic steps:
sudo port install php53 php53-cgi
This should create /opt/local/bin/php53 and php-cgi53, so next:
cd /opt/local/bin
ln -s php53 php
ln -s php-cgi53 php-cgi
Then register the PHP Interpreter with PHP Home set to /opt/local/bin and it should detect it and "Open in Browser" correctly.
For PhpStorm, I am forced to use the built-in web server when i try to view the code in the browser. If anyone got a way to do that without their built-in server, that would be great too. I have a zend server installed already.
You are NOT forced in any way.
Just configure Deployment entry (Preferences | Deployment) and mark it as Default for this project. The URL defined there will be used when previewing pages from PhpStorm.
Without deployment entry the built-in web server is used by default.

PECL install failed

after upgrading from PHP5.2.6 to php 5.3. it seams, I also have to reinstall the PHP memcache-module.
So I downloaded the newest version of memcache (3.0.6) and followed this documentation:
http://www.php.net/manual/en/install.pecl.pear.php
pecl install memcache
Which results in the following error-message:
No releases available for package "pecl.php.net/memcache"
install failed
what's going on here? By the way: the server is not connected to the Internet, but that shouldn't be a problem, right?!
To answer my own question an for rising the intellectual horizon of #OZ_ and #martswite
an offline-installation of an pecl extension works like the following way:
1.) download the extension from http://pecl.php.net/packages.php
2.) there you get an .tgz file
3.) install the file:
pear install memcache-3.0.6.tgz
PECL modules are (by default, and most of the time) downloaded from a non-local repository.
Therefore you will need some form of internet connection to download it.
Alternatively you can upload the pecl package from your machine to a location on the servers local file system and install it from there, or compile from source.
To me this error was caused due to php without support for ssl.
Enable openssl or recompile with openssl built int.
Check php support in a Linux host run
php -i | grep openssl
Should print a line with openssl if support enabled.

PHP ICONV glibc to libiconv on CentOS 5.5

I'm having a few issues with the PHP function iconv, which I've tracked down the the iconv implementation. As the manual states, "Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the GNU libiconv library." http://uk3.php.net/manual/en/intro.iconv.php
I've downloaded the libiconv library from http://www.gnu.org/software/libiconv/ and installed it without any problems using:
$ ./configure --prefix=/usr/local
$ make
$ make install
My problem now is how to link this installation to PHP? From what i've read I need to recompile PHP with --with-iconv-dir=/usr/local/
but how do I do this on CentOS? I installed php with yum install php.x86_64
I tried yum reinstall php but when I service httpd restart my phpinfo reads the same, glibc.
Is there a better way to install libiconv on CentOS? If not how do I get PHP using this installation without upsetting yum?
Many thanks in advance
compiled php from source seems to be the way
php -m > /tmp/php.modules to list of compiled module for php
backup your current php.ini
yum uninstall php
download the php
and base on your existing module + iconv - almost all steps has been detailed here : http://www.php.net/manual/en/install.unix.apache2.php#90478 (except never advise u to backup php.ini)
You should manually recompile the php iconv extension (in the php-x.y.z/ext/iconv/ subdirectory) after manual changing of the configure script to force it to select GNU libiconv instead of glibc's iconv. See my answer for the similar Stack question.

Categories