Installing PHP INTL in mac not getting it right - php

I have installed php56-intl using Homebrew like so: brew install php56-intl
and when I do php -m | grep intl it gives me intl
But when I check in my phpinfo() file, doesn't show up intl.
Not sure what am I missing.
Update
All I want to install intl in my computer so that I could run my zend application. But whatever I do I don't get it done.
An error occurred An error occurred during execution; please try again
later.
Additional information:
Zend\I18n\Exception\ExtensionNotLoadedException File:
/Applications/XAMPP/xamppfiles/htdocs/skeleton/vendor/zendframework/zend-i18n/src/Filter/AbstractLocale.php:24
Message:
Zend\I18n\Filter component requires the intl PHP extension

The problem was, intl was installed in my mac but not in XAMPP.
Alright, after long hassle here how I succeeded:
Go to your terminal and
cd /Applications/XAMPP/bin
Then php -m | grep intl, if it returns you intl then it is installed. If not installed then should return empty.
Now, sudo ./pecl install intl
Will ask specify where ICU libraries and headers can be found, simply hit enter,
And this will install intl, also will return this message You should add "extension=intl.so" to php.ini.
So simply add this to your php.ini file and restart your apache: sudo apachectl restart or hard restart from XAMPP itself.
Hope this helps someone else.

I encountered similar issue with OsX default php and not having the intl extension. This is what solved my issue:
brew install php56 (make sure you have hombebrew installed)
in your httpd.conf Find line LoadModule php5_module libexec/apache2/libphp5.so, comment it
Add below that line : LoadModule php5_module /usr/local/opt/php53/libexec/apache2/libphp5.so, for your case just change the php53 to php54.

Related

how to complete install php trader extension

Hi i am using Virtual box for using ubuntu 16.04 for this project
https://medium.com/#joeldg/an-advanced-tutorial-a-new-crypto-currency-trading-bot-boilerplate-framework-e777733607ae
i have complete install successfully to composer update
when i type composer update and hit enter i got error
than i have added extension=trader.so to php.ini and checking on phpinfo() its show me
it showing me installed but still facing same error
help me sorry for my bad english
Install trader: sudo pecl install trader
Find the correct php.ini by running php -i | grep ini
Add the extension to php.ini by adding following code: extension=trader.so
Restart PHP/Webserver
Check if trader got installed correctly: php -m | grep trader
Enabling the extension is not enough,
you need to install it on your system,
sudo apt-get update
sudo apt-get install php-pear php7.1-dev
pear install trader
The PHP version used by the command line (the one Composer uses) is not necessarily the same used by Apache. The screenshot you attached is showing Apache's version, which appears to have the extension installed. However, if you do
php -m
you'll see that the extension is not installed in the CLI version. So go to the php.ini (you can see where it is in the Loaded Configuration File entry for the output of the php -i command), and add/uncomment the extension line:
extension=trader.so
The following method can be applied from the command line for many php extensions, still okay php-7.4.
Note, this particular extension can only be used from php-cli.
Note, you have to feed >50 OHLCV points before this extension starts to respond, or just fail silently.
// Mandatory to install phpize:
sudo apt install php-dev
// This library is required by pecl:
sudo apt install php-xml
// Actual extension compilation from sources:
sudo pecl install trader
// Edit the CLI version of php.ini. (/etc/php/7.4/cli)
// Find php.ini path:
php -i | grep ini
// Declare the extension extension=trader.so
sudo /bin/sh -c 'echo "extension=trader.so" >> /etc/php/7.4/cli/php.ini'

Magento PHP Extension intl - XAMPP

I tried to install Magento on localhost (XAMPP) for the first time today. As Magento installer does the Readiness Check an error occurs, as it is missing PHP Extension intl. I have done research, but all I can find is to remove ; from ";extension=php_intl.dll" in php.ini in etc folder. This does not work (tried to restart XAMPP and the computer several times)
This is driving me crazy, please help.
I am on macOS Sierra.
First of all, you should check with phpinfo() method to check intl loaded or not. some time may this loaded bud you are in the mistakes.
after that, check php_intl.dll existin this folder : "\xampp\php\ext"
if all of these are ok, you may check log files.
UPDATE:
Base on your update about OS,if you have homebrew available and have PHP7:
$ brew install php70-intl // For PHP7.0
$ brew install php71-intl // For PHP7.1
For PHP5.5:
$ brew install php55-intl
Re-open your terminal window to ensure it works right in your session. To see if it loaded via your CLI interpreter:
$ php -m | grep intl
Or:
$ php -i "(command-line 'phpinfo()')" | grep intl
Source: https://daveismyname.blog/blog/install-php-intl-on-mac-using-homebrew
You need to check your correct php.ini file and also create a php file with a function phpinfo() and run this file and check the extension that are not installed.
To enable/installed these extension go to php.ini file and uncomment those extension.
save this file and restart the apache/xampp
I hope it will work for you.

Install postgresql with apache on Mac OSX

I am trying to make postgresql work with apache on my Mac OSX. I use homebrew to manage all my dev features, so I replace the default php version provided by apache and download a homebrew version, this part works really fine. The problem is when I want to install the postgresql extension..
I have done this :
brew install postgresql
brew install php55 --with-postgresql
brew install php55-pdo-pgsql
And then edit the /etc/apache2/httpd.conf file to replace LoadModule php5_module libexec/apache2/libphp5.so by LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so.
Then when I exec the phpinfo() command, I can't see the postgresql extension installed in the PDO section. I only have this :
If anyone can help ;) Thank you all !
Possible solution :
- First install all packets like this : brew install postgresql php55 php55-pdo-pgsql
- Then brew reinstall php55 --with-postgresql
And it works.. I did this before (maybe not the same order) and it didn't work, I do not know why it works now !
Solution
When you watch the phpinfo() result, you should see something something like Loaded Configuration File and *Scan this dir for additional .ini files *. The thing is there is a global php.ini file and a .ini file per extension you install.
The value for *Scan this dir for additional .ini files * is where the .ini file for the extension must be located. So just need to create a ext-pdo_pgsql.ini and load the extension with extension="path to your/pdo_pgsql.so" (mine was /usr/local/opt/php55-pdo-pgsql/pdo_pgsql.so).
And for the installation just need brew install php55 php55-pdo-pgsql postgresql
Run php -m | grep pgsql to know if pgsql exists
Follow the example in this answer. Jump to note if you have a problem with the instruction there corresponding to number 4 here.
Enter ./configure --with-pdo-pgsql="path to postgres" and return. Mine is at "/usr/local/bin".
Enter make && sudo make install and return.
Add the extension to php.ini with sudo echo "extension=pdo_pgsql.so" >> path to php.ini. Find the path using php -i | grep php.ini
That should install pdo driver for postgres
Note
It is possible that sudo make install doesn't work. It might be due to an OSX feature known as csrutil. Reboot your machine and hold down cmd + R. From the recovery inteface run csrutil disable from terminal.
Reboot again and perform the make install. Repeat same process as in the paragraph above to enable csrutil by running csrutil enable at the recovery interface's terminal.

can't find mcrypt => Call to undefined function Laravel\mcrypt_create_iv()

Trying to set up Laravel and keep getting hit with this error. I installed mcrypt through brew and it is located in /usr/local/Cellar. Any thoughts? .. It's not showing up in terminal command php -m either, if that matters. I'm running Mountaion Lion with macs native web server.
Ubuntu or any Debian based Linux users can install the required package with apt-get:
sudo apt-get install php5-mcrypt
Remember to restart the web server afterwards:
sudo service apache2 restart
If it still doesn't work, try to link the configuration file to the appropriate configuration folder for the web server. Thanks to dave1010 for this hint in the comments.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/ # for Apache
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cli/conf.d/ # for CLI
And again, restart the web server:
sudo service apache2 restart
Perhaps, if not working yet, you need also the line showed by #RahulPrasad, with php5enmod mcrypt.
You need to enable it in your php.ini file as well and probably restart Apache.
In php.ini you will find ;mcrypt.so and remove the ; from it.
Or, if it's not in there, just add mcrypt.so somewhere.
Also the salt option has been deprecated as of PHP 7.0.0. It is now preferred to simply use the salt that is generated by default.
Try sudo php5enmod mcrypt && sudo service apache2 restart
You've installed mcrypt when you actually wanted the php56-mcrypt php module.
You stated in your question that you can see mcrypt installed in /usr/local/Cellar and that you're using OSX. So, the easiest way to install the mcrypt PHP module on OSX using Homebrew is:
// assuming you have php56
brew install php56-mcrypt
If homebrew can't find the correct package you may need to tap the PHP repositories found on GitHub:
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
Now when you issue the command brew search mcrypt, you should see something like:
libtomcrypt mcrypt php53-mcrypt php54-mcrypt php55-mcrypt php56-mcrypt
Several other posters have mentioned the need to edit your php.ini file. This will be unnecessary as homebrew will take care of activating the module for you. It places the configuration file at /usr/local/etc/php/5.6/conf.d/ext-mcrypt.ini
You don't have the mcrypt PHP extension installed.
For a Mac, I followed these instructions:
mcrypt on Mac 10.7 or 10.8.
They look like a lot, but it's not, it's very easy to follow in it works!
You may have installed mycrypt but not have the php_mcrypt module installed / enabled.
Just a note for people who have recently upgraded to PHP 7 - The MCRYPT library has been deprecated. If you upgraded to PHP 7 and are now seeing this error, that is why. You should switch to an alternative library, some alternatives are mentioned in this thread.
Go to the CLI folder in your php instalation, and find php.ini in there and enable mcrypt. Terminal sometimes uses another php.ini, which is usually in the CLI folder.
I installed php and mcrypt with Homebrew, but I still experienced this error after doing brew update a few times. I think my setup has just gotten a bit borked over time.
It turns out my php was being configured from /private/etc/php.ini, not /usr/local/etc/php/5.4/php.ini as Homebrew recommends. Mcrypt is not even being included from /usr/local/etc/php/5.4/ext-mcrypt.ini which doesn't make a lot of sense considering php -i produces this for me:
Configuration File (php.ini) Path => /usr/local/etc/php/5.4
Loaded Configuration File => /usr/local/etc/php/5.4/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/5.4/conf.d
Additional .ini files parsed => /usr/local/etc/php/5.4/conf.d/ext-mcrypt.ini
My solution:
Edit /private/etc/php.ini as a superuser
Add extension="/usr/local/Cellar/php54-mcrypt/5.4.28/mcrypt.so" and save
Restart Apache with sudo apachectl restart
This is what finally worked for me:
brew reinstall --with-homebrew-curl --with-httpd php56
brew reinstall --build-from-source php56-mcrypt
I also had to do sudo chmod 777 /usr/local/etc/php/5.6/conf.d because I got errors when the second brew reinstall tried to add the ext-mcrypt.ini to that directory.

mb_convert_encoding, undefined function while mbstring is enabled

I have a server (Ubuntu 11.10 x64) running PHP 5.3.8 with Apache2 / MySQL. I'm currently working on a project where I'm required to do some specific character encoding, but I found out that none of the multibyte (mb_* functions) are working.
However, when I look in phpinfo(), I see that multibyte support is enabled.
I've tried things like apt-get install php5-mbstring, php-mbstring, php-multibyte, etc. etc. but none seem to work.
Can anyone point me in the right direction for this? Thanks in advance!
edit: Fixed it by recompiling PHP (this was my last resort, which I initially wanted to avoid)
./configure --enable-mbstring
The weird this is, phpinfo() already showed that it was enabled. I don't know why it didn't work before :/
A lot of newer Linux servers do not have PHP Multibyte modules installed by default. A simple solution is often to install php-mbstring.
On Red Hat flavors (CentOS, Fedora, etc.) you can use yum install php-mbstring.
Make sure you restart your Apache server afterwards. Use service httpd restart on RH flavors.
In the case of your installation is php5.6 is similar to solution of neilsimp1:
Running sudo apt-get install php7.0-mbstring and then sudo service php7.0-fpm restart did the trick for me.
sudo apt-get install php5.6-mbstring
and then restart apache service
sudo service apache2 restart.
Sometimes people receiving this kind of error : Fatal error: Call to undefined function mb_convert_encoding() in /public_html/this/this.php at line 188. Normally this kind of errors comes in PHP Sites and PHP framework aswell.
It looks like PHP mbstring not installed on your server.
Solution :
In my case I have just uncomment ;extension=php_mbstring.dll in php.ini file and issue has been resolved.
Don't forget to restart apache server after uncomment ;extension=php_mbstring.dll
Code taken from this blog: http://chandreshrana.blogspot.in/2016/01/call-to-undefined-function.html
Check if MBString is Installed
You can know if it is actually installed or not with the -m (Show compiled in modules) arg...
php -m | grep mbstring
If installed, you will see mbstring as the output from the above, or blank if it is not installed.
Install MBString
If you have the newest PHP (PHP8 right now), you can install with...
apt-get install php-mbstring
yum install php-mbstring
If you have PHP7, and you need an older MBString, then install with...
apt-get install php7.0-mbstring
yum install php7.0-mbstring
Restart the Server
Restart the server after install with this at your command line:
/etc/init.d/apache2 restart
Refer back to step 1 to check that MBString actually installed.

Categories