PHP IMAP not working, installed with Macports - php

I recently installed PHP5 with Macports using sudo port install php5 +imap. However, when I run /opt/local/bin/php -i, I don't see the IMAP module listed under the other modules. Is there an additional step or change I need to make to php.ini or otherwise to get this module enabled?
Also, running /usr/bin/php -i (I believe this is the php NOT installed by Macports) also does not show IMAP configured.

PHP modules have been available as variants in previous versions of the php5 port, but have been moved into their own ports long time ago. You can see the available variants with port variants php5, which does not list that +imap anymore. Most probably you followed an oudated tutorial.
To get the IMAP module install the port php5-imap:
sudo port install php5-imap

Related

PHP Gnupg is not showing up as an extension in phpinfo() and I can't use it in php

I have gnupg and gpgme installed using homebrew.
I also linked both and made sure they are installed and linked by running brew gnupg install and brew gpgme install and got the message confirming the installation and the version.
I have placed the gnupg.so file in the extension path and also added extension=gnupg.so into the php.ini file.
I got the extension path and the specific php.ini's path from the infophp page.
After restarting mamp, I still don't see gnupg or gpgme as extensions on phpinfo, neither I can use gnupg in my php code.
using $gpg = new \gnupg(); this gives me error saying gnupg class doesn't exist.
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'gnupg' not found
I tried another approach:
I also manually downloaded both gnupg and gpgme from their website extracted them ran following
./configure,
make,
sudo make install,
and was able to install successfully again, also made sure that gnupg.so is in the same path that shows up in phpinfo page for extension path and also added extension=gnupg.so to the same php.ini that appears in phpinfo page (I added the extension=gnupg.so right after all the other extensions in the php.ini file)
I am using:
mac os high sierra 10.13.3
php 7.1.12
mamp 4.4.1
gnupg 2.2.5 (I tried this version with brew install)
gnupg 1.4.0 (I tried this version with downloading from gnupg.org)
gpgme 1.10.0
I also would like to know, after hopefully fixing the above mentioned problems, do I need to include anything in my php file in order to use gnupg?
what are the differences between gnupg and gpgme? do I need both in order to encrypt a file in php?
if I wasn't able to fix this what is another way to encrypt xml files or files containing text data? I need to encrypt the file and FTP to another server and decrypt it over there.
Thank you all in advance for your help
I was able to solve this issue using Pecl to install GnuPG.
This link helped me a lot as well.
Run the following in order to install the library:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libgpgme11-dev
sudo pecl install gnupg
Restart your server with: "service apache2 restart", or "sudo service phpX.Y-fpm-sp restart" where x.y is the major.minor version of your php. Note: there are multiple different ways to restart the system so the changes take effect, so please do your own research on how to do it depending on the server and your php version.
As I've explained in my question, try to find the right php.ini file to add the "extension=gnupg.so" into. most common places you'll find your php.ini are:
/etc/php/7.2/apache2 (you can use your PHP version instead of 7.2)
/etc/php/7.2/cli (you can use your PHP version instead of 7.2)
The better way is to find out the php.ini path that loads the extensions, from the phpinfo()
Now Verify that it all went well with the following command:
"php -i | grep -i gnup"
If everything is working as expected you'll see something like this:
/etc/php7.0-sp/conf.d/gnupg.ini,
gnupg
gnupg support => enabled

phpStorm problems with php-cgi

So I recently change to ubuntu and I am trying to setup my environment again and I manage to install LAMP and phpmyadmin and phpstorm.
But what I can't mange to do is to run the php script from phpStorm when I try to run the program the page gives me a "502 Bad gateway" error and when I go back on phpStorm it tells me that php-cgi was not found.
I have tried to fix the problem but couldn't find any solid answer and I am so confused right now
Also I have successfully added the php interpreter and the xDebug
on linux ubuntu
For PHP5: sudo apt-get install php5-cgi
For PHP7: sudo apt-get install php7.0-cgi
I faced with the same problem. After replacing /usr/bin/php5-cgi with a little shell script I found that error
Host 'localhost' has multiple addresses. You must choose one
explicitly! Couldn't create FastCGI listen socket on port
localhost:56468
After commenting 127.0.0.1 localhost in /etc/hosts the problem seems to be solved.
After commenting IPv6 hosts the problem seems to be solved:
# The following lines are desirable for IPv6 capable hosts
# ::1 localhost ip6-localhost ip6-loopback
# ff02::1 ip6-allnodes
# ff02::2 ip6-allrouters
for mac:
install XAMPP (it's easy and straight forvard) it comes with apache and php interpreter
in phpstorm in settings ->php -> interpreter choose path /Applications/XAMPP/bin/php
phpstorm in settings -> build, ... -> Deployment add in place server, url root localhost
More info can be found on jetbrains web page
This helped me to solve this problem and run php by clicking on web browser icon inside phpstorm.
and don't forget to turn on apache in xampp --> manage servers!)
If it's not already done install Homebrew :
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Now, that we've Homebrew, tap php repositories by entering this on your terminal :
brew tap josegonzalez/php
brew tap homebrew/dupes
Check what options are available for PHP 5.4 :
brew options php54
Now install/build PHP 5.4 with some option (in your case PHP-FPM with CGI) :
brew install php54 --with-fpm --with-debug --with-cgi --with-libmysql --with-homebrew-curl
brew install fastcgi
Note : If you're not going to use Apache add --without-apache, if you need others things, just check the options and add what you need
Now, check if PHP-FPM is enable by typing this in your terminal :
php-fpm -v
If you get this :
PHP 5.4.24 (fpm-fcgi) Copyright (c)
1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013
Zend Technologies
You just installed PHP with FCGI like a boss..
Found it Here
Basically the who page says to do this.
Download the interpreter thing oh php from php.net.
Do make install
Make a file called newpath.txt and add to it
PATH=~/custom/php5/bin:$PATH
export PATH
Type cat newpath.txt >> .profile
I will make a youtube video and upload it.
I also experienced the same problem before, however to have the right PHP version installed for your current version is the first step, then before starting the IDE, ensure that you have the php7.x-cgi version installed
open the terminal and input
sudo apt update && sudo apt install php7.x-cgi
replace the x with the version number, then after that you need to configure your IDE to find the path to your PHP installation directory
In the "PHP-CGI Server" tab in phpStorm you see the error:
/usr/bin/php-cgi -e -b localhost:52109
Host 'localhost' has multiple addresses. You must choose one explicitly!
Couldn't create FastCGI listen socket on port localhost:52109
PHP-CGI Server terminated
There curently seems not to be any fix for this known bug: https://youtrack.jetbrains.com/issue/WI-24373
Commenting out either the IPv4 or the IPv6 address for localhost in /etc/hosts (on Linux) is a workaround.
I also had this problem. It depends on your version of php that you want to use it as interpreter in your PhpStorm.
This error message shows that PhpStorm needs to CGI binary to execute your code.
I'm using Ubuntu 18.04 and PHP version that I have used is 7.2.
You need to install modules based on your application requirements. So you use this following command to search available PHP 7 modules in the package repository:
sudo apt-cache search php7*
Now you can see all of available modules (also for cgi) in repository. Now You must install the required PHP modules on your system as below command. Make sure to install packages for correct PHP version by specifying the version with the package name. Without defining the package version, it will install the latest package. E.g. for me, I need php7.2-cgi :
sudo apt install php7.2-cgi
Now cgi is installed. You must restart PhpStorm and test it again. It works well for me.

How to install and configure php in openwrt

I have developed some pages in PHP and HTML. But the PHP pages were not working when I put these pages in OpenWrt www folder. I have installed php5 in OpenWrt. These pages were working fine with apache localhost in ubuntu. In OpenWrt, It has uHTTPd. Do I need to install anything other than just php5 (other modules) or Do I need to configure something?
For PHP5 configuration on OpenWRT see: http://wiki.openwrt.org/doc/uci/uhttpd
First, install PHP
opkg update
opkg install php5
opkg install php5-cgi
Install any other additional php5 extensions you may use. To see available packages:
opkg list php5*
Example:
opkg install php5-mod-sockets
Open your /etc/php.ini and uncomment any of the extensions you just installed. Continuing with the sockets example above the following:
;extension=sockets.so
becomes
extension=sockets.so
Now open /etc/config/uhttpd and add the following line:
list interpreter ".php=/usr/bin/php-cgi"
Don't forget to restart uhttpd:
/etc/init.d/uhttpd restart
One option in regards to your space (flash) limitations of installing PHP on your embedded device: if you have access to a USB port on your embedded device (like many do) you can set up your base openWRT configuration with extroot. Essentially you will boot to a USB drive thereby enabling all of the space of the USB drive to install packages and add files. See: http://wiki.openwrt.org/doc/howto/extroot
Actually you do need to install a server (such as Apache), and if you want data persistence, a database (such as MySQL)
I found a complete guide for exactly what you wish:
http://wiki.openwrt.org/doc/howto/lamp

php5 curl: Recompiling does not reflect in phpinfo

I am trying to get curl to work on my Oracle Linux OS, but I am running into some walls. I am loading my phpinfo() page using an Apache + Django combined server. Furthermore, I have made sure to uncomment the extension=php_curl.dll line in the php.ini file, and I have added the extension=curl.so line. I have also attempted to compile php again using ./configure --with-curl=/usr/include/curl/, followed by the make and sudo make install method calls. However, this recompiling is not reflecting in the phpinfo() page, which still shows a later build date and a different configuration command. As an added note, I am pretty sure I have curl installed. I've run sudo yum install php-curl and sudo yum install curl, and both have responded to me, saying that the php-common and curl packages, respectively, have already been installed.
Does anyone have any advice? Thanks.
I had a similar problem and the solution was to install libcurl & libcurl-devel.

PHP extension "curl" must be loaded. PHP extension "soap" must be loaded

I am very new to magento and currently I am getting "PHP Extension curl must be loaded" error during magento installation.
Can you help me?
If your server does not have curl installed on it you can type one of the following commands to install it:
For Debian/Ubuntu based systems you can type below command
sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart
For RedHat/CentOS based systems you can type (as root)
yum install php5-curl
/etc/init.d/httpd restart
This should install curl and have it start to work for you.
remove ';' from extension=php_curl.dll in php.ini , maybe you don't have active de mod.
Do and look if you have it active.
Before installing Magento or any other system take a look at the system requirements:
For Magento:
Supported Operating Systems:
Linux x86, x86-64
Supported Web Servers:
Apache 1.3.x
Apache 2.0.x
Apache 2.2.x
Supported Browsers:
Microsoft Internet Explorer 6 and above
Mozilla Firefox 2.0 and above
Apple Safari 2.x
Google Chrome
Adobe Flash browser plug-in should be installed
PHP Compatibility:
5.2
Required extensions:
PDO_MySQL
simplexml
mcrypt
hash
GD
DOM
iconv
curl
SOAP (if Webservices API is to be used)
Safe_mode off
Memory_limit no less than 256Mb (preferably 512)
MySQL:
4.1.20 or newer
InnoDB storage engine
SSL:
If HTTPS is used to work in the admin, SSL certificate should be valid. Self-signed SSL certificates are not supported
Server - hosting - setup:
Ability to run scheduled jobs (crontab) with PHP 5
Ability to override options in .htaccess files
To install CURL check this page depending on your platform
1: Find extension=php_soap.dll in php.ini and remove the semicolon(;)
2: Restart your Server
Josh's answer should work fine with PHP5, but if you're on PHP7 (for Debian/Ubuntu based systems):
sudo apt-get install php-curl
Then restart your server.
Also, no need to uncomment the extension in php.ini once this is done.
Sorry for adding an answer, not enough points to comment on che-azeh's answer, which should be:
sudo apt-get -y install php7.0-curl

Categories