关于编译安装php
之前也装过一次是nginx和php的, 这次也是... but, 不知道是不是版本的问题还是环境方面的影响, 导致之前的gd库是安装失败的, 所以上次安装zabbix也是失败的, 这次换了5.6.2版本, 居然可以了.... 有了gd库, 但是在安装的时候openssl还是抛出问题, 这个是不是关乎到gcc编译版本的问题, 不管了, 我都是直接扔出去, 先实现功能再说需要, 后期再补, 好了不扯, 上教程
1.下载编译安装包(忽略)
我用的是5.6.2
2. 解压(忽略)
我一般扔在/home/test
3.编译configure
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-pcntl --enable-mysqlnd --enable-opcache --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-zip --enable-ftp --enable-soap --enable-xml --enable-mbstring --disable-rpath --disable-debug --disable-fileinfo --with-mysql --with-mysqli --with-pdo-mysql --with-pcre-regex --with-iconv --with-zlib --with-mcrypt --with-gd --with-mhash --with-xmlrpc --with-curl --with-imap-ssl
细心的就会发现, 我这里是扔掉openssl的.
4.make && make install
直接make && make install
没啥好说的
5.配置nginx(安装成功的情况下!!在make的时候可能抛出set --enable-opcach=no问题)
1.扔一个index.php进根目录
nginx.conf
location / { root html; index index.html index.htm index.php; }
2.放开php模块的注释, 指定fastcgi_param SCRIPT_FILENAME网站目录
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; include fastcgi_params; }
细心的也会发现, 这个跟之前php+nginx配置的是一致的
6.nginx的重新加载和重启
service nginx reload service nginx restart
7.最后当然就是测试了
编一个php测试进nginx的html目录, 当然啦这个文件放哪里都一样, 只要在nginx放开php模块那里配置您的目录就行
test.php
<?php echo phpinfo(); ?>
8.启动php模块
这个文件一般在php安装目录的sbin下
/usr/local/php/sbin/php-fpm
9.成功, 这次是有GD库!!
10. 安装抛出BUG
抛出: Don't know how to define struct flock on this system, set --enable-opcach=no vim /etc/ld.so.conf.d/local.conf 添加:/usr/local/lib 重新加载:ldconfig /etc/ld.so.conf.d/local.conf 抛出: openssl抛出提领指向不完全类型的指针 我是直接扔掉openssl, 就是在./configure中去掉了openssl, 顺利编译, make