I have a mac book with php. 7.3 version. I have installed php intl and when i run the following command in terminal it is working fine.
php -r "locale_set_default('de-DE'); echo locale_get_default();"
But same code if i run in php file it`s giving error Call to undefined function CodeIgniter\locale_set_default(). Could you please some one help me.
Related
I am developing a PHP project. I am using Mac OS X now. To be honest, this is the first time developing a PHP project using Mac. I am a Windows. I installed PHP using Brew by running the following command.
brew install php
It gave me the php latest version, 7+. For my project, I need to use php version 5.6. So, I installed another PHP by running this command.
brew install php56
Up until this point when I enter "php --version" in the terminal, it is showing that I am using php version 7+. I found some solution to change php version and so I used one of them and run this command.
alias php='/usr/local/etc/php/5.6/php'
After running that command, when I type in "php --version" in the terminal, it is showing this error.
-bash: /usr/local/etc/php/5.6/php: No such file or directory
Now, I cannot use any PHP on my Mac right now. How can I fix that?
Can't remove php from mac, tried everything on web
I tried to remove it via Terminal, and when i type php -v it returns : command not found, but when I try to install magento on the localhost It says I still have php 7.2 installed, tried to remove with homebrew, terminal, no use
Please help me to remove it, or at least downgrade to php 7.0
If I run "phpbrew switch 5.6.3" followed by "php -v", i get 5.9.3 (PHP System Version) as current PHP Version.
If I run phpbrew "use 5.6.3", i also get 5.6.3 with php -v.
Is there any solution for this problem? PHP version 5.6.3 is installed and built with phpbrew and working after using the use command.
I am using Elementary OS Freya (Ubuntu 14.04) with the latest phpbrew version.
If you are getting a red error line "You should not see this, if you see this, it means you didn't load the ~/.phpbrew/bashrc script, please check if bashrc is sourced in your shell.", then you need to run source ~/.phpbrew/bashrc. It's also a good idea to run echo "source $HOME/.phpbrew/bashrc" >> ~/.bashrc, so that in the future this will be automatic.
When I try to install Laravel 4 via Composer, I get the following message in Terminal
Mcrypt PHP extension required. Script php artisan optimize handling
the post-install-cmd event returned with an error
The PHP version on my computer is 5.5.3 and when I run phpinfo it shows that mcrypt is enabled. When I run the which php command in Terminal it shows
/usr/bin/php
I therefore extended the $PATH with .bash_profile.
export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
Unfortunately, the which php command still shows /usr/bin/php after extending $PATH. And as a result the error is still there.
So I am out of ideas on how to solve this issue. Does anyone have an idea? Thanks!
There is difference between the MAMP PHP version and you "Terminal" PHP version. Therefore are you probably setting up the export path.
When you are changing the export path you have to restart your terminal before it will take effect on your computer.
I am not sure of this but when your error is appearing and older version of Laravel will be installed.
What do you get when you execute: php -v in your terminal?
I'm having a bizarre problem with php 5.3.6 and ImageMagick (command line) using MAMP (and Macports too..I tried both) on OS X.
When I run the identify command from the CLI, it works fine. But when I run the exact same command using exec(), it returns a value code of 5 and in the apache error logs I have:
dyld: Library not loaded: /opt/local/lib/libfreetype.6.dylib
Referenced from: /opt/local/bin/identify Reason: Incompatible
library version: identify requires version 14.0.0 or later, but
libfreetype.6.dylib provides version 13.0.0
E.g.
The cli command is:
/opt/local/bin/identify /Users/leonardteo/Documents/1.jpg
This works just fine when executed from the command line. When executed from PHP:
exec("/opt/local/bin/identify /Users/leonardteo/Documents/1.jpg", $output, $return);
$return is 5
$output is nothing
Checking the apache logs gives the above issue with libfreetype.
I installed ImageMagick using Macports. I've also tried a manual build from source and running identify from /usr/local/bin/identify and I get the same result. I have also tried running PHP from Macports instead of MAMP and I get the same result.
Could someone please help shed light on this?
Edit this file:
/Applications/MAMP/Library/bin/envvars
Comment out the following lines:
DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH