PHP openssl in Ubuntu - php

I have created a web app which uses PHPMailer for mailing and its working properly on my local server(Windows OS). However, when I uploaded it to the production server(Ubuntu 14.04.4) it returned an error which says “Message could not be sent.Mailer Error: Extension missing: openssl”.I tried looking for solution but nothing works. Anyway I'm using PHP5.3.6. I hope you guys can help me.

You can compile the openssl extension.
first step :
download the php source in the version you are using .
then run command:
tar zxvf php-yourphpversion.tar.gz
cd php-yourphpversion/ext/openssl/
#notice if you have error "cannot find config.m4" when run phpize , you
#should rename the file "config0.m4" to "config.m4" by command
#"mv config0.m4 config.m4"
/usr/local/php/bin/phpize #here is your php location have install
#in my computer ,the php is location in
# /usr/local/php/ so the phpize is in
# /usr/local/php/bin/phpize
#(your php location)/bin/php-config
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
make
sudo make install
then the openssl will install and return a path
in my computer it return /usr/local/php/lib/php/extensions/debug-zts-20160303/
finally modify php.ini and restart php-fpm :
extension_dir = "the path return after install" #you should add the return path here
extension=openssl.so

Related

Unable to use PHPIZE after update to MacOS Mojave

What i should do when i run PHPIZE and get the error below ? I already installed xcode command line tools.
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Potential better solution - force reinstall the header files. Fixed a ton of problems for me system wide.
Running the following command will reinstall the developer tools header files and should fix the issue.
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
For some reason, I found Xcode command line tools was not installed completely on my Mac, Finally I solved this problem as follow:
1. xcode-select --install
2. cd /Library/Developer/CommandLineTools/Packages/
3. open macOS_SDK_headers_for_macOS_10.14.pkg
Note: After doing step2, if there is no .pkg file in the dir. maybe this solution will not help you.
find the phpize and edit it,
~$ whereis phpize
phpize: /usr/local/bin/phpize
~$ vim /usr/local/bin/phpize
in my phpize script it is like that
prefix='/usr/local/php7' ## where you should edit
datarootdir='/usr/local/php7/php'
exec_prefix="`eval echo ${prefix}`"
phpdir="`eval echo ${exec_prefix}/lib/php`/build"
includedir="`eval echo ${prefix}/include`/php"
...
phpize_get_api_numbers()
{
# extracting API NOs:
PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
}
if you comfirm that you have the header file but the phpize script configure is wrong ,you can edit the row
prefix='/usr/local/php7'
and php.h is in
$ pwd
/usr/local/php7/include/php/main
$ ls php.*
php.h
if not ,you can compile php by yourself
I had the same issue as described above, only I was trying to install xdebug on macOS Mojave.
I resolved the issue by executing:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Failed-loading xdebug installation - xdebug.so, 9 no suitable image found

After installing xdebug extentions as follows
Download xdebug-2.6.0alpha1.tgz
Unpack the downloaded file
Run: cd xdebug-2.6.0alpha1
Run: phpize
Run: ./configure
Run: make
Run: cp modules/xdebug.so
/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions/no-debug-non-zts-20151012
Edit /usr/local/etc/php/7.0/php.ini and add the line zend_extension =
/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
I get the error when run php -v
Failed loading /usr/local/Cellar/php70/7.0.26_18/lib/php/extensions
/no-debug-non-zts-20151012/xdebug.so:
dlopen(/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions
/no-debug-non-zts-20151012/xdebug.so, 9): no suitable image found.
Did find:
/usr/local/Cellar/php70/7.0.26_18/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so:
stat() failed with errno=20
When I use the service of Xdebug analyse popinfo() output, it will ask the exactly the same steps to do.
It am not sure what no suitable image found means. The path exists. Could anyone have any ideas how to fix it?
I sorted the problem out by adding
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
on .bash_profile.
PHP 7.1 came with OSX 10.13.2, so default path was set to the pre-packed php, which shows the error on phpinfo.

How to install IonCube Loader on Amazon Linux x64 instance

I'm having trouble installing IonCube Loader on my Amazon Linux x64 instance.
I'm following these instructions below but the paths are way off and I can't seem to locate the right ones on my install.
For x64:
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz
Proceed as follows:
cp ioncube/ioncube_loader_lin_5.3.so /usr/lib/php5/20090626/ioncube.so
Now edit to match:
zend_extension = /usr/lib/php5/20090626/ioncube.so
nano /etc/php5/conf.d/ioncube.ini
First, there is no /usr/lib/php5/20090626/ folder. I changed these paths to /usr/lib64/php/modules and included the .so file in there.
However, I cannot seem to locate any ioncube.ini file to edit. Any help is appreciated...
Thank you!
For future readers sake, there is a difference between Amazon's Linux and other versions that most articles online refer to.
You can follow the first two steps above to get the installer, I like to use a temporary folder. Do this as root:
sudo -i
cd /tmp
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfvz ioncube_loaders_lin_x86-64.tar.gz
Copy the required extension to a slightly different folder under EC2 linux instances, and the loader wizard to your webroot:
cp ioncube/ioncube_loader_lin_5.4.so /usr/lib64/php/modules/ioncube.so
Create your ini file:
echo "zend_extension=/usr/lib64/php/modules/ioncube.so" > /etc/php.d/ioncube.ini
Reload Apache (if you're using it):
service httpd restart
I'm using NGINX and PHP-FPM, in this case you'd probably want to restart PHP-FPM as well as NGINX.
Lastly, use the loader wizard to test it by navigating to http://example.com/loader-wizard.php, and delete the temp files and loader wizard when finished:
rm -rf /tmp/ioncube*
rm /var/www/html/loader-wizard.php
I followed the instructions provided here in the first answer, making allowance for the fact that I'm runnning PHP 5.6:
sudo cp ioncube_loader_lin_5.6.so /usr/lib64/php/5.6/modules/ioncube.so
echo "zend_extension=/usr/lib64/php/5.6/modules/ioncube.so" > /etc/php.d/ioncube.ini
However, when restarting Apache, I found that it started then failed immediately. The Apache log gave me this error:
PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0
I changed the name of the file from ioncube.so to 00-ioncube.so and restarted Apache. This solved the problem by making this file load before the other modules.

trying to install xdebug: configure file not found

I am following these instructions to download xdebug: http://xdebug.org/wizard.php. The output of the wizard was this:
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.4.17
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: no
Configuration File Path: /bitnami/mampstack-osx-x64/output/php/lib
Configuration File: /Applications/mampstack-5.4.17-2/php/etc/php.ini
Extensions directory: /Applications/mampstack-5.4.17-2/php/lib/php/extensions
giving these instructions
Download xdebug-2.2.3.tgz
Unpack the downloaded file with tar -xvzf xdebug-2.2.3.tgz
Run: cd xdebug-2.2.3 Run: phpize (See the FAQ if you don't have phpize.
Run: ./configure
Everything works properly up to step #4. In step #4 I get
MyMacBookAir$ ./configure
-bash: ./configure: No such file or directory
If I look in xdebug-2.2.3 I see that there is no file called configure -- but I do see a file called configure.in. Did I get .tgz that is missing the configure file? Or am I not understanding some part of the instructions properly?
Actually it could be a problem with phpize command
If it complains for autoconf ("Cannot find autoconf") then try next
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
sudo make install
#akh2103 I assume you have your problem fixed by now but I leave this answer here for anybody else has this issue.
I've just suffered from the same problem. For me I was installing it on a linked directory
eg ~/Downloads was actually on /media/1234/Data/Downloads
For some reason when I transferred all my downloads onto my other HDD the other day the permissions have been haywire.
After I moved the initial xdebug file to my ~/.Desktop and unpacked it there I ran
chmod -R 0755 x-debug/
and then ran phpize
Then I could see the configure file that didn't appear when I tried to do it on my other HDD.
I hope this helps anybody else who suffered from this problem.
John

Call to undefined function filter_var()

After transfering my site to another hosting i got this error:
Fatal error: Call to undefined function filter_var() in
/home/ultrastep/ultrastep.ru/docs/sites/all/modules/q_cart/q_cart.module on line 410
PHP version on server is 5.2.10.
Any ideas whats wrong?
You need to have the php module "Filter" installed
In case someone else stumbles upon this like I did, here is the solution I found for Redhat/CentOS:
http://www.cyberciti.biz/faq/rhel-cento-linux-install-php-pecl-filter/
Install php-devel
You need to install php-devel to compile php extensions:
yum install php-devel
Download php source code
php_pcre.h header file is not includes with php source code 5.1.6, so you need php source code as well. Visit php.net to grab latest version and store to /opt directory. Use lynx and elinks:
cd /opt
elinks http://www.php.net/get/php-5.2.6.tar.bz2/from/a/mirror
Save php source to code to disk. Next, extract source code:
tar -jxvf php-5.2.6.tar.bz2
Download filter extension
Visit pecl extension to grab latest source code for filter:
cd /opt
wget http://pecl.php.net/get/filter-0.11.0.tgz
Install filter extension
Unrar file:
tar -jxvf filter-0.11.0.tgz
cd filter-0.11.0
Open logical_filters.c file:
vi logical_filters.c
Find line that read as follows:
include "ext/pcre/php_pcre.h"
Change to (the absolute path of php_pcre.h is required):
include "/opt/php-5.2.6/ext/pcre/php_pcre.h"
Save and close the file. Finally, type the following commands to compile extension:
phpize
./configure
make install
Configure Filter Extension
Type the following command:
echo 'extension=filter.so' > /etc/php.d/filter.ini
Restart httpd:
service httpd restart

Categories