These options needlearning to matchh有人遇到过这样的怪问题吗

2677人阅读
C/C++(9)
& & & &这些问题,还是说明了。在windows下开发PHP扩展的环境,不够完美,但是有时候我们不得不在windows下进行开发。所以遇到问题就狂吐,然后狂解决,然后几经折磨考验后,终于解决了或者放弃了。这里列举一些问题,参考一下吧。
1.有时候在ext文件夹下你添加的扩展,可能导致
cscript /nologo configure.js --with-php-build=&F:\php_win\win32build& --without-libxml
--disable-odbc
无法正常执行,所以在搭建php开发环境的时候,保证ext目录是官方给出,把自己的扩展源文件项目先不要放到ext目录下
如果你在启动apache中有报错为:
PHP Warning: PHP Startup: martin: Unable to initialize module\nModule compiled with build ID=API,TS\nPHP compiled with build ID=API,TS,VC6\nThese options need to match\n in Unknown on line 0
Warning: PHP Startup: martin: Unable to initialize module
Module compiled with build ID=API,TS
PHP compiled with build ID=API,TS,VC6
These options need to match
in Unknown on line 0
如果cscript /nologo configure.js --with-php-build=&F:\php_win\win32build& --without-libxml
--disable-odbc
脚本执行成功的话是不会出现的,因为这个脚步会检查你的vc版本,进行配置。
所以你的开发环境要和你的Lamp环境保持一致,就不会出现版本同一问题。都是由一个编译器版本编译的就可以了
3.没有找到config.w32.h
这个你懂的,没找到,说明生成,总不能让你自己写一个
4.待续,补充
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:989494次
积分:12566
积分:12566
排名:第1098名
原创:301篇
转载:28篇
评论:68条
文章:57篇
阅读:146864
文章:45篇
阅读:289465
(1)(2)(2)(2)(2)(2)(2)(1)(11)(14)(1)(1)(2)(1)(1)(1)(1)(6)(4)(3)(7)(5)(6)(5)(13)(7)(19)(13)(35)(92)(12)(6)(3)(5)(15)(9)(2)(11)(5)(1)(1)Mac OS上搭建LNMP开发环境 - 简书
Mac OS上搭建LNMP开发环境
安装Homebrew
安装Homebrewruby -e "$(curl -fsSL /mxcl/homebrew/go)"检查是否存在冲突brew doctor对Homebrew更新升级brew update && brew upgrade安装Nginx安装nginxbrew install nginx安装oh-my-zsh
mac 自带zsh,在终端中输入cat/etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
输入zsh --version,可以查看zsh版本。输入brew install zsh,可以安装最新版的zsh。输入 chsh -s /bin/zsh,并重启终端,可以将系统默认的终端shell改为zsh。然后安装oh-my-zshsh -c "$(curl -fsSL /robbyrussell/oh-my-zsh/master/tools/install.sh)"安装php-fpm添加源
brew tap homebrew/dupes
brew tap homebrew/php
安装php-fpmbrew install php56 --whitout-apache --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm将PHP、PHP-FPM加入环境变量
在终端中vim .zshrc找到export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"这一行,在其后面添加homebrew下载php、php-fpm路径配置,使其如下所示
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
export PATH="$(brew --prefix homebrew/php/php56)/sbin:$PATH"
$(brew --prefix homebrew/php/php56)/bin是使用homebrew下载的php$(brew --prefix homebrew/php/php56)/sbin是使用homebrew下载的php-fpm/usr/bin是MAC自带的php/usr/sbin是MAC自带php-fpm然后使其立即生效source .zshrc查看$PATH,最前面的路径先后后面的路径
?~echo $PATH
/usr/local/opt/php56/sbin:/usr/local/opt/php56/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
查看php、php-fpm版本
PHP 5.6.19 (cli) (built: Mar 24 :30) (DEBUG)
Copyright (c)
The PHP Group
Zend Engine v2.6.0, Copyright (c)
Zend Technologies
?~php-fpm -v
PHP 5.6.19 (fpm-fcgi) (built: Mar 24 :33) (DEBUG)
Copyright (c)
The PHP Group
Zend Engine v2.6.0, Copyright (c)
Zend Technologies
?~/usr/bin/php -v
PHP 5.5.31 (cli) (built: Feb 20 :10)
Copyright (c)
The PHP Group
Zend Engine v2.5.0, Copyright (c)
Zend Technologies
?~/usr/sbin/php-fpm -v
PHP 5.5.31 (fpm-fcgi) (built: Feb 20 :26)
Copyright (c)
The PHP Group
Zend Engine v2.5.0, Copyright (c)
Zend Technologies
从上面可见,配置的环境变量是正确的,homebrew先于系统自带的执行。
//启动php-fmp
参考安装MySQLbrew install mysql执行完如上命令后,有如下输出结果
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
To connect run:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
从上面的一段文字来看,安装mysql后,用户名是root,但是没有密码。如果设置密码的话,执行mysql_secure_installation命令。如果不想设置密码的话,可以执行mysql.server start,然后mysql -uroot,如下图所示
nhf:~ nanhangfei$mysql.server start
Starting MySQL
. SUCCESS!
nhf:~ nanhangfei$ mysql -uroot
Welcome to or \g.
Your MySQL connection id is 2
Server version: 5.7.11 Homebrew
Copyright (c) , Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type '' or '\h' for help. Type '\c' to clear the current input statement.
如果想要设置root的密码的话,执行下面的命令,做些相关的设置。mysql_secure_installation安装phpmyadminbrew install phpmyadmin配置Nginx首先,为我们的配置文件创建一些文件夹
mkdir -p /usr/local/etc/nginx/logs
mkdir -p /usr/local/etc/nginx/sites-available
mkdir -p /usr/local/etc/nginx/sites-enabled
mkdir -p /usr/local/etc/nginx/conf.d
mkdir -p /usr/local/etc/nginx/ssl
sudo mkdir -p /var/www
sudo chown :staff /var/www
sudo chmod 775 /var/www
修改nginx配置文件vim /usr/local/etc/nginx/nginx.conf替换其内容为
worker_processes
/usr/local/etc/nginx/logs/error.
worker_connections 256;
default_type
application/octet-
log_format
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log
/usr/local/etc/nginx/logs/access.
keepalive_timeout
index index.html index.
include /usr/local/etc/nginx/sites-enabled/*;
然后创建php-fpm配置文件:vim /usr/local/ect/nginx/conf.d/php-fpm其内容如下,这个文件的意思是nginx中的php文件交由php-fmp解析
location ~ \.php$ {
$uri = 404;
fastcgi_pass
127.0.0.1:9000;
fastcgi_index
fastcgi_param
SCRIPT_FILENAME $document_root$fastcgi_script_
创建默认虚拟主机default:vim /usr/local/etc/nginx/sites-available/default其内容如下所示
/var/www/;
access_log
/usr/local/etc/nginx/logs/default.access.
location / {
/usr/local/etc/nginx/conf.d/php-
location = /info {
127.0.0.1;
rewrite (.*) /.info.
error_page
error_page
创建ssl默认虚拟主机default-sslvim /usr/local/etc/nginx/sites-available/default-ssl其内容如下所示:
/var/www/;
access_log
/usr/local/etc/nginx/logs/default-ssl.access.
ssl_certificate
ssl/localhost.
ssl_certificate_key
ssl/localhost.
ssl_session_timeout
ssl_protocols
SSLv2 SSLv3 TLSv1;
ssl_ciphers
HIGH:!aNULL:!MD5;
ssl_prefer_server_
location / {
/usr/local/etc/nginx/conf.d/php-
location = /info {
127.0.0.1;
rewrite (.*) /.info.
error_page
error_page
创建phpmyadmin虚拟主机vim /usr/local/etc/nginx/sites-available/phpmyadmin其内容如下所示
/usr/local/share/
/usr/local/etc/nginx/logs/phpmyadmin.error.
access_log
/usr/local/etc/nginx/logs/phpmyadmin.access.
ssl_certificate
ssl/phpmyadmin.
ssl_certificate_key
ssl/phpmyadmin.
ssl_session_timeout
ssl_protocols
SSLv2 SSLv3 TLSv1;
ssl_ciphers
HIGH:!aNULL:!MD5;
ssl_prefer_server_
location / {
index.html index.htm index.
/usr/local/etc/nginx/conf.d/php-
设置SSLmkdir-p /usr/local/etc/nginx/sslopenssl req -new -newkey rsa:4096-days365-nodes -x509 -subj"/C=US/ST=State/L=Town/O=Office/CN=localhost"-keyout /usr/local/etc/nginx/ssl/localhost.key -out /usr/local/etc/nginx/ssl/localhost.crtopenssl req -new -newkey rsa:4096-days365-nodes -x509 -subj"/C=US/ST=State/L=Town/O=Office/CN=phpmyadmin"-keyout /usr/local/etc/nginx/ssl/phpmyadmin.key -out /usr/local/etc/nginx/ssl/phpmyadmin.crt创建虚拟主机软连接,开启虚拟主机ln -sfv /usr/local/etc/nginx/sites-available/default /usr/local/etc/nginx/sites-enabled/defaultln -sfv /usr/local/etc/nginx/sites-available/default-ssl /usr/local/etc/nginx/sites-enabled/default-sslln -sfv /usr/local/etc/nginx/sites-available/phpmyadmin /usr/local/etc/nginx/sites-enabled/phpmyadmin安装php-fpm、nginx、mysql、phpmyadmin是参考的这两篇文章, 但在安装过程中,会出现几个问题,但原文章并没有说明。下面是碰到的问题及解决方案。启动php-fmp、nginx、mysqlphp-fmp确认php-fpm监听9000端口
?~sudo lsof -Pni4 | grep LISTEN | grep php
php-fpm32898root8uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
php-fpm32899_www0uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
php-fpm32900_www0uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
php-fpm32901_www0uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
启动nginxsudo nginx重新加载配置|重启|停止|退出nginx -s reload|reopen|stop|quit确认nginx在监听80端口?~sudo lsof -Pni4 | grep LISTEN | grep nginx或者index.html复制到nginx的根目录/var/www中去
?~curl -IL http://localhost/index.html
HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Sun, 27 Mar :30 GMT
Content-Type: text/html
Content-Length: 611
Last-Modified: Thu, 24 Mar :35 GMT
Connection: keep-alive
ETag: "56f"
Accept-Ranges: bytes
启动mysqlmysql.server start先登录mysql -uroot -p确定mysql端口
mysql& show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port| 3306|
+---------------+-------+
如果安装PHP时出现如下错误checking if the location of ZLIB install directory is defined... noconfigure: error: Cannot find libz解决方式是在终端中执行如下命令xcode-select --install参考 启动php-fmp时的问题
?~/usr/local/opt/php56/sbin/php-fpm
[26-Mar-:40] NOTICE: PHP message: PHP Warning:PHP Startup: mcrypt: Unable to initialize module
Module compiled with build ID=API,NTS
PHPcompiled with build ID=API,NTS,debug
These options need to match
in Unknown on line 0
Warning:PHP Startup: mcrypt: Unable to initialize module
Module compiled with build ID=API,NTS
PHPcompiled with build ID=API,NTS,debug
These options need to match
in Unknown on line 0
Unknown(0) : Warning - PHP Startup: mcrypt: Unable to initialize module
Module compiled with build ID=API,NTS
PHPcompiled with build ID=API,NTS,debug
These options need to match
[26-Mar-:40] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[26-Mar-:40] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[26-Mar-:40] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (48)
[26-Mar-:40] ERROR: FPM initialization failed
解决办法,在终端执行如下命令brew reinstall php56-mcrypt --build-from-source参考 上一步完成后,又出现如下问题
?~sudo /usr/local/opt/php56/sbin/php-fpm
[26-Mar-:10] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (48)
[26-Mar-:10] ERROR: FPM initialization failed
查看谁占用了9000端口
?~sudo lsof -i:9000
COMMAND PID USERFDTYPEDEVICE SIZE/OFF NODE NAME
php-fpm 707 root7uIPv4 0xb477d0t0TCP localhost:cslistener (LISTEN)
php-fpm 708 _www0uIPv4 0xb477d0t0TCP localhost:cslistener (LISTEN)
php-fpm 709 _www0uIPv4 0xb477d0t0TCP localhost:cslistener (LISTEN)
php-fpm 710 _www0uIPv4 0xb477d0t0TCP localhost:cslistener (LISTEN)
杀掉进程id 707、708、709、710
?~sudo kill -9 707
?~sudo kill -9 708
?~sudo kill -9 709
?~sudo kill -9 710
?~sudo /usr/local/opt/php56/sbin/php-fpm
[26-Mar-:29] NOTICE: fpm is running, pid 32706
[26-Mar-:29] NOTICE: ready to handle connections
确认php-fpm监听9000端口
?~sudo lsof -Pni4 | grep LISTEN | grep php
php-fpm32898root8uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
php-fpm32899_www0uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
php-fpm32900_www0uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
php-fpm32901_www0uIPv4 0xTCP 127.0.0.1:9000 (LISTEN)
?~php-fpm -D[25-Mar-:28] ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2)[25-Mar-:28] ERROR: failed to load configuration file '/private/etc/php-fpm.conf'[25-Mar-:28] ERROR: FPM initialization failed?~解决方法: php-fpm --fpm-config /usr/local/etc/php/5.6/php-fpm.conf又出现了如下错误
?~php-fpm --fpm-config /usr/local/etc/php/5.6/php-fpm.conf
[25-Mar-:52] ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)
[25-Mar-:52] ERROR: failed to post process the configuration
[25-Mar-:52] ERROR: FPM initialization failed
vim /usr/local/etc/php/5.6/php-fpm.conf然后添加,error_log = /usr/local/var/log/php-fpm.log 保存
?~php-fpm --fpm-config /usr/local/etc/php/5.6/php-fpm.conf
[25-Mar-:54] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[25-Mar-:54] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[25-Mar-:54] NOTICE: fpm is running, pid 1026
[25-Mar-:54] NOTICE: ready to handle connections
参考Nginx的网站目录
配置文件路径: /usr/local/etc/nginx/nginx.conf默认的网站根目录: /usr/local/opt//nginx/html启动nginx问题nginx: [error] open() “/usr/local/var/run/nginx.pid” failed参考
?~sudo nginx
nginx: [warn] 1024 worker_connections exceed open file resource limit: 256
因为ulimit -n的值为256,所以将/usr/local/etc/nginx/nginx.conf配置文件中的worker_connections设置为2562010年11月 PHP大版内专家分月排行榜第三2010年9月 PHP大版内专家分月排行榜第三
2013年5月 总版技术专家分月排行榜第一
2016年7月 总版技术专家分月排行榜第二2016年3月 总版技术专家分月排行榜第二2015年12月 总版技术专家分月排行榜第二2014年8月 总版技术专家分月排行榜第二2014年7月 总版技术专家分月排行榜第二2013年6月 总版技术专家分月排行榜第二
本帖子已过去太久远了,不再提供回复功能。}

我要回帖

更多关于 match to match with 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信