


Delete the old php version and install the latest php version and Xdebug under mac system
The content of this article is about deleting the old php version and installing the latest php version and Xdebug under the mac system. It has a certain reference value. Now I share it with everyone. Friends in need can refer to it
My 2015 macpro system has version php5.6.28 installed by default. I installed php7.0 and php7.1 using brew or other online methods. However, when I print phpinfo(), my php5. It happened again on 6.28. I felt like I had obsessive-compulsive disorder and I had to fix it. I wasted more than a day and tried almost every method on the Internet. However, many of them can only be used for reference and are of little use, because everyone's computer environment may be slightly different. Now that it's done, record it here.
My first step is to delete the php version I see. I plan to delete all php on the computer and then reinstall the latest version. This operation is risky and requires caution. This is what the Internet says: ps: It is not recommended to delete the built-in PHP version because some software may depend on the PHP environment. Although you can self-compile or use brew to install a new version of PHP, it is not recommended for novices. Remember to do it before operating. Use TM to back up the system so that files can be restored after a mistake.
But you don’t have to do this. One more version should be fine. During the deletion process, the executable file php in the user/bin directory cannot be deleted. Although there is a way to delete any file in safe mode on Mac, I did not do it. This file is retained, and there is also php. -config, when you open the file with vi, you can see that the php version is the oldest. I guess this may be the cause.
#When I thought the others were deleted, I used brew to reinstall the php7.1 version. At this time, you will find that this directory issue has become a top priority. Many tutorials and paths on the Internet are no longer available. . Then follow this article.
brew After installing php7.1, there will be a paragraph below:
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1
##To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@ 7.1/lib/httpd/modules/libphp7.so
#### SetHandler application/x-httpd -php
##
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1/
This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.1/sbin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/php@7.1/lib
CPPFLAGS: -I/usr/local/opt/php@7.1/include
To have launchd start php@7.1 now and restart at login:
brew services start php@7.1
##Or , if you don't want/need a background service you can just run:
php-fpm
This information is very useful, it tells Some methods and installation paths. I only read this information when I was desperate, and realized that I really couldn’t ignore it and couldn’t follow the above tips step by step. You should all be able to understand it, if not you can leave a message. After finishing, don’t forget to restart php-fpmLet’s talk about the detour I took when restarting npmroot 21891 0.0 0.0 112660 960 pts/3 R+ 16:18 0:00 grep --color=auto php-fpm root 42891 0.0 0.1 182796 1220 ? Ss 4月18 0:19 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) nobody 42892 0.0 0.6 183000 6516 ? S 4月18 0:07 php-fpm: pool www nobody 42893 0.0 0.6 183000 6508 ? S 4月18 0:17 php-fpm: pool www
php-fpm --fpm-config /usr/local/etc/php/5.4/php-fpm.conf --prefix /usr/local/var
brew services start php@7.1 This command
PHP 7.1.16 (fpm-fcgi) (built: Apr 12 2018 03:25:57)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
with Zend OPcache v7.1.16, Copyright (c) 1999-2018, by Zend Technologies
mengdeMacBook-Pro:var GHM$ php -v
PHP 7.1.16 (cli) (built: Apr 12 2018 03:25:50) ( NTS )
Copyright ( c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
with Zend OPcache v7.1.16, Copyright (c) 1999-2018, by Zend Technologies
PHP Version 7.1.16
System | Darwin mengdeMacBook-Pro.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64 |
Build Date | Apr 12 2018 03:24:25 |
Configure Command | './configure' '--prefix=/usr/local/Cellar/php@7.1/7.1.16_1' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/7.1' '--with-config-file-path=/usr/local/etc/php/7.1' '--with-config-file-scan-dir=/usr/local/etc/php/7.1/conf.d' '--with-pear=/usr/local/Cellar/php@7.1/7.1.16_1/share/php@7.1/pear' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-dtrace' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-opcache-file' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-webhelper' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-apxs2=/usr/local/opt/httpd/bin/apxs' '--with-bz2' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-gmp=/usr/local/opt/gmp' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos' '--with-layout=GNU' '--with-ldap' '--with-ldap-sasl' '--with-libedit' '--with-libzip' '--with-mcrypt=/usr/local/opt/mcrypt' '--with-mhash' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-ndbm' '--with-openssl=/usr/local/opt/openssl' '--with-pdo-dblib=/usr/local/opt/freetds' '--with-pdo-mysql=mysqlnd' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--with-pdo-pgsql=/usr/local/opt/libpq' '--with-pgsql=/usr/local/opt/libpq' '--with-pic' '--with-png-dir=/usr/local/opt/libpng' '--with-pspell=/usr/local/opt/aspell' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-webp-dir=/usr/local/opt/webp' '--with-xmlrpc' '--with-xsl' '--with-zlib' '--with-curl' |
坑多,两天了有些我也忘了,谁有遇到问题可以留言。。。
下面说下xdebug 安装
建议按官方,少走弯路
打开这个xdebug 官方页面
然后command+a 全选,command +v 复制,放到框框里面,运行底部的按钮,会打印出很多我们安装xdebug所需要用到的信息
按步骤走就好了,有一点坑就是,当执行phpsize 的时候报:command cannot find ,这时候找到brew 安装php 的可执行bin目录,直接用那个里面的phpsize 拿来运行,绝对路径运行就可以执行了。还有官方下载的页面有两级目录,而且名字一样,别弄错了,不然运行不了。
Download xdebug-2.6.0.tgz
Unpack the downloaded file with
tar -xvzf xdebug-2.6.0.tgz
Run:
cd xdebug-2.6.0
-
Run:
phpize
(See the FAQ if you don't havephpize
.As part of its output it should show:
Configuring for: ... Zend Module Api No: 20160303 Zend Extension Api No: 320160303
Copy after loginIf it does not, you are using the wrong
phpize
. Please followthis FAQ entry and skip the next step. Run:
./configure
Run:
make
Run:
cp modules/xdebug.so /usr/local/lib/php/pecl/20160303
Edit
/usr/local/etc/php/7.1/php.ini
and add the linezend_extension = /usr/local/lib/php/pecl/20160303/xdebug.so
Restart the webserver
然后,刷新pathinfo() ,command+f 查找xdebug
看到这样就成功了
然后就是配置xdebug 了
相关推荐:
The above is the detailed content of Delete the old php version and install the latest php version and Xdebug under mac system. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
