I try to install openswoole on my mac machine. I have this issue when installing it.
/usr/local/Cellar/php#7.4/7.4.29/include/php/ext/pcre/php_pcre.h:25:10: fatal error: pcre2.h: No such file or directory
#include "pcre2.h"
I used the command brew install pcre to fix this issue as others recommend, but I always get the same result. I try to open the folder pcre I only see one php_pcre.h file inside it.
Here's simplest solution. I have finally solved my problem. I used PHP 8.1.7 - Mac Pro 2022 - Apple Silicon (M1)
My errors: fatal error: 'pcre2.h' file not found
The solution that I used:
1. brew install pcre2
2. ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /opt/homebrew/Cellar/php/8.1.7/include/php/ext/pcre/pcre2.h
Please check your path again when use `ln -s`
3. sudo pecl install ... something you want to install :) **openswoole** with you :).
Success Installation:
Hope it help you :) Thanks
try:
sudo ln -s /opt/local/include/pcre.h /usr/include/ "replace your file location here"
sudo pecl install apc
For M1 MacBooks, this is how I fixed that error when installing rdkafka.
pecl install rdkafka
Error
/Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
Solution
ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/pcre2.h
See the new link
➜ cd /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre
➜ ls -l
total 8
lrwxr-xr-x 1 ddhondup admin 48 Oct 6 15:29 pcre2.h -> /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h
-rw-rw-r-- 1 ddhondup admin 3970 Oct 1 2021 php_pcre.h
After adding the link, it worked.
Build process completed successfully
Installing '/Applications/MAMP/bin/php/php8.0.8/lib/php/extensions/no-debug-non-zts-20200930/rdkafka.so'
install ok: channel://pecl.php.net/rdkafka-6.0.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=rdkafka.so" to php.ini
Related
I have been developing with Vallet for some time now. Today i wanted to update laravel 5.4 to 5.5. Before doing so i run composer global update. Causing Vallet to stop working.
Fist i tried to do the following:
cd ~/.composer/
sudo chown -R $(whoami) vendor
source: https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error
I did not solve the issue. Then i decided to reinstall Vallet. Hereby i did the following:
I followed this: https://github.com/laravel/valet/issues/321
Stop and uninstall services
sudo brew services stop php71 dnsmasq nginx
brew uninstall php71 dnsmasq nginx
Remove related config files and valet home folder
sudo rm -r /usr/local/etc/php /usr/local/etc/nginx /usr/local/etc/dnsmasq.conf
sudo rm -r ~/.valet /var/root/.valet
Install services i tried this:
brew install php71
$ brew tap homebrew/php
$ brew install php71
brew install homebrew/php/php71
All gave the following error:
MacBook-Pro:~ mblivier$ brew install homebrew/php/php71
==> Installing php71 from homebrew/php Error: The following formula: php71
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:xcode-select --install
I new in this and don't know how to solve this. Any suggestions how to install php and go further with reinstalling Vallet?
homebrew is installed and working
You need xcode to build php, so first run:
xcode-select --install
to install xcode and later you can brew install php71
This is answer for your comment, I can't post as comment, need to post because is length limited.
There is one of two things going on here, either you didn't install PHP, or PHP is installed and not currently in any of system aware paths. First I would try to find PHP and make sure it exists:
$ find / -name php -type f
You should see something like:
/path/to/your/php/bin/php
If PHP binary does exist, check your path:
$ echo $PATH
If it does not exist, recompile php.
If PHP exists on your system, make sure the path to the /bin/php file is included. You can edit your ~/.bash_profile and add the custom path like this:
PATH=$PATH:/path/to/your/php/bin/
....
export PATH
Then save and reload the file to ensure your current session has access to new path changes:
$ source ~/.bash_profile
With any luck you can now do a php -v and see the version response.
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 /
I'm trying to install Laravel Valet, which requires php 7.1, but when i run brew install php71, I get the following error:
==> Pouring php71-7.1.10_21.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink sbin/php-fpm
/usr/local/sbin is not writable.
I get the same error when i run brew link php71. If i run php -v, I actually see that I'm currently running PHP 7.1.7.
But when I run valet install, I get:
[DomainException]
Unable to determine linked PHP.
I don't even have an sbin directory in /usr/local.
Any suggestions?
I solved this problem by first creating the directory sbin:
sudo mkdir /usr/local/sbin
then if you are like me using macOS highSierra 10+ you need to run:
sudo chown -R $(whoami) $(brew --prefix)/sbin
after this
brew link php
Installing Laravel Valet, I had a similar issue with sbin not being writable. I had to make the directory, then utilized the solution included at this page. This finally allowed me the proper permissions to run a brew link command with a previously installed version of php 7.1.
I'm having trobule installing phpDocumentor via PEAR on a CentOS machine and I don't even know if this is pear or php related.
Here are the commands that I executed and their output:
# pear -v install phpdoc/phpDocumentor
## http://pastebin.com/2ijRG9KW
# /usr/local/bin/phpdoc
-bash: /usr/local/bin/phpdoc: No such file or directory
# tree -a -h /usr/local/lib/php/phpDocumentor/
## http://pastebin.com/NjynYKPL
I've included the tree command because I'm thinking something is not OK there...
At first glance, is this a PEAR or phpDocumentor issue?
Edit
Tried
# whereis phpdoc
phpdoc: /usr/local/bin/phpdoc
But
# cd /usr/local/bin
# ls -l | grep -i phpdoc
lrwxrwxrwx. 1 root root 48 Nov 23 21:46 phpdoc -> /usr/local/lib/php/phpDocumentor2/bin/phpdoc.php
-rwxr-xr-x. 1 root root 1039 Nov 24 21:31 .tmpphpdoc*
Guess what...
-bash: cd: /usr/local/lib/php/phpDocumentor2: No such file or directory
But there is a phpDocumentor folder (instead of phpDocumentor2) whose tree is available on this pastebin
I encountered the same issue and found there was no phpdoc link in my folder /usr/local/bin
To remedy the problem, I used pear config-show to allow me to view where the PEAR Bin directory is and then created a symbolic link that the phpdoc file in that location.
My PEAR Bin directory is set to: /usr/local/Cellar/php55/5.5.8/bin/
My Local Bin directory is set to: /usr/local/bin
To create the link:
ln -s /usr/local/Cellar/php55/5.5.8/bin/phpdoc /usr/local/bin/phpdoc
You can use pear config-show to see what directory it uses as its bin_dir, which is where the PEAR installer puts its "binaries". I had thought that the main Linux distributions had preconfigured their PEAR setups to use /usr/bin as the right location, so you might try /usr/bin/phpdoc. Granted, /usr/bin is almost always in your default PATH, so just trying phpdoc along should usually be sufficient.
That memory limit error from the PEAR installer means that the PEAR installer itself crashed while attempting to install phpDocumentor. You'll need to edit your php.ini file to increase the value of the memory_limit parameter. It looks like right now it's defaulted to a tiny 8MB. I'd suggest at least 256MB unless this is a small/old computer. You should then try a reinstall (pear install --force phpdoc/phpdocumentor). I expect the --force will be necessary since PEAR might think it had installed it successfully already. If install gives trouble, then try update --force instead.
In the same folder where I've executed pear install I found an error_log file:
[23-Nov-2013 22:27:54 UTC] PHP Fatal error: Allowed memory size of
33554432 bytes exhausted (tried to allocate 8192 bytes) in
/usr/local/lib/php/PEAR/Installer.php on line 580
Gotcha.
I'm attempting to install php and php-cgi with Homebrew.
brew install https://github.com/ampt/homebrew/raw/php/Library/Formula/php.rb
Using this method returns the following errors.
==> make
clang: clangerror: : linker command failed with exit code 1 (use -v to see invocation)error:
linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [sapi/cgi/php-cgi] Error 1
I've updated Homebrew, and the XCode command line tools. The only warning brew doctor gives me is that a few Python "config" scripts exist outside my system or Homebrew directories.
Anyone know what the issue could be? Where can I look for more detailed error messages?
I'm not familiar with the ampt tap, when I grabbed php I used the josegonzalez tap. You could try that.
$ brew tap josegonzalez/homebrew-php
You can also get more information by using the -vd options to brew install.
$ brew install -vd https://github.com/ampt/homebrew/raw/php/Library/Formula/php.rb
I just unlinked my 5.3.13 php from josegonzalez and ran the above command. With the -vd I can see the ./configure command run and all the output from it as well as the commands make invokes and compiler output. Whew, this is taking a while to build.
It does fail for me with this output
==> cp ./php.ini-production /usr/local/Cellar/php/5.3.10/etc/php.ini
cp ./php.ini-production /usr/local/Cellar/php/5.3.10/etc/php.ini
cp: /usr/local/Cellar/php/5.3.10/etc/php.ini: No such file or directory
/usr/local/Library/Homebrew/formula.rb:553:in `system
Looks like the Formula never creates ${prefix}/etc. I blame the formula. Try josegonzalez tap.
$ rm /Library/Caches/Homebrew/Formula/php.rb
$ brew tap jozegonzalez/homebrew-php
$ brew install php53
As a comment on homebrew-php repository just force link libxml2
brew link libxml2 --force