编译安装php参考资料
MySQL PHP API
http://dev.mysql.com/doc/apis-php/en/index.html
nginx + php +mysql 最简单安装 官方介绍
http://php.net/manual/zh/install.unix.nginx.php
php下载地址:
http://cn2.php.net/distributions/php-5.6.7.tar.gz
编译php环境需要的包
- autoconf: 2.13+(PHP < 5.4.0),2.59+(PHP >= 5.4.0)
- automake: 1.4+
- libtool: 1.4.x+(除了 1.4.2)
- re2c: 版本 0.13.4 或更高
- flex: 版本 2.5.4(PHP <= 5.2)
- bison: 版本 1.28(建议),1.35 或 1.75
[root@localhost /]# yum -y install flex 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extras: mirrors.btte.net * updates: mirrors.sina.cn 正在解决依赖关系 --> 正在检查事务 ---> 软件包 flex.x86_64.0.2.5.37-3.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在安装: flex x86_64 2.5.37-3.el7 base 292 k 事务概要 ================================================================================ 安装 1 软件包 总下载量:292 k 安装大小:744 k Downloading packages: flex-2.5.37-3.el7.x86_64.rpm | 292 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : flex-2.5.37-3.el7.x86_64 1/1 验证中 : flex-2.5.37-3.el7.x86_64 1/1 已安装: flex.x86_64 0:2.5.37-3.el7 完毕! [root@localhost /]#
[root@localhost /]# yum -y install libtool 已加载插件:fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extras: mirrors.btte.net * updates: mirrors.sina.cn 正在解决依赖关系 --> 正在检查事务 ---> 软件包 libtool.x86_64.0.2.4.2-20.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在安装: libtool x86_64 2.4.2-20.el7 base 588 k 事务概要 ================================================================================ 安装 1 软件包 总下载量:588 k 安装大小:2.2 M Downloading packages: libtool-2.4.2-20.el7.x86_64.rpm | 588 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : libtool-2.4.2-20.el7.x86_64 1/1 验证中 : libtool-2.4.2-20.el7.x86_64 1/1 已安装: libtool.x86_64 0:2.4.2-20.el7 完毕! [root@localhost /]#
php下载
下载目录:/usr/local/src (没有wget yum -y install wget 安装)
[root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.7.tar.gz
--2015-04-09 17:02:13-- http://cn2.php.net/distributions/php-5.6.7.tar.gz
正在解析主机 cn2.php.net (cn2.php.net)... 202.108.5.184, 202.108.5.133
正在连接 cn2.php.net (cn2.php.net)|202.108.5.184|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:17756830 (17M) [application/x-gzip]
正在保存至: “php-5.6.7.tar.gz”
100%[======================================>] 17,756,830 3.62MB/s 用时 4.5s
2015-04-09 17:02:18 (3.77 MB/s) - 已保存 “php-5.6.7.tar.gz” [17756830/17756830])
php解压
[root@localhost src]# tar zxvf php-5.6.7.tar.gz -C /usr/local/bin
安装基础模块 libxml2-devel
这里忘记记下了 就用以前的了~
[root@localhost php-5.6.5]# yum -y install libxml2-devel
已加载插件:fastestmirror
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.hustunique.com
* updates: mirrors.skyshe.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 libxml2-devel.x86_64.0.2.9.1-5.el7_0.1 将被 安装
--> 正在处理依赖关系 libxml2 = 2.9.1-5.el7_0.1,它被软件包 libxml2-devel-2.9.1-5.el7_0.1.x86_64 需要
--> 正在处理依赖关系 xz-devel,它被软件包 libxml2-devel-2.9.1-5.el7_0.1.x86_64 需要
--> 正在检查事务
---> 软件包 libxml2.x86_64.0.2.9.1-5.el7 将被 升级
---> 软件包 libxml2.x86_64.0.2.9.1-5.el7_0.1 将被 更新
---> 软件包 xz-devel.x86_64.0.5.1.2-8alpha.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
libxml2-devel x86_64 2.9.1-5.el7_0.1 updates 1.0 M
为依赖而安装:
xz-devel x86_64 5.1.2-8alpha.el7 base 44 k
为依赖而更新:
libxml2 x86_64 2.9.1-5.el7_0.1 updates 664 k
事务概要
================================================================================
安装 1 软件包 (+1 依赖软件包)
升级 ( 1 依赖软件包)
总下载量:1.7 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): xz-devel-5.1.2-8alpha.el7.x86_64.rpm | 44 kB 00:00
(2/3): libxml2-devel-2.9.1-5.el7_0.1.x86_64.rpm | 1.0 MB 00:00
(3/3): libxml2-2.9.1-5.el7_0.1.x86_64.rpm | 664 kB 00:01
--------------------------------------------------------------------------------
总计 1.0 MB/s | 1.7 MB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : libxml2-2.9.1-5.el7_0.1.x86_64 1/4
正在安装 : xz-devel-5.1.2-8alpha.el7.x86_64 2/4
正在安装 : libxml2-devel-2.9.1-5.el7_0.1.x86_64 3/4
清理 : libxml2-2.9.1-5.el7.x86_64 4/4
验证中 : libxml2-devel-2.9.1-5.el7_0.1.x86_64 1/4
验证中 : xz-devel-5.1.2-8alpha.el7.x86_64 2/4
验证中 : libxml2-2.9.1-5.el7_0.1.x86_64 3/4
验证中 : libxml2-2.9.1-5.el7.x86_64 4/4
已安装:
libxml2-devel.x86_64 0:2.9.1-5.el7_0.1
作为依赖被安装:
xz-devel.x86_64 0:5.1.2-8alpha.el7
作为依赖被升级:
libxml2.x86_64 0:2.9.1-5.el7_0.1
完毕!
编译安装php前 必备库的安装 gd库等
1.gd库
phpize 编译安装GD库 好像都没用到phpize
http://www.cnblogs.com/xxx91hx/p/4466581.html
编译安装php
把php安装在 /usr/etc/php下
加粗的是正确最小 使用
定义安装目录--prefix
定义php.ini路径--with-config-file-path
启动fpm --enable-fpm
在php源码里 /usr/local/bin/php-5.6.7
./configure
--prefix=/usr/etc/php
--with-config-file-path=/usr/etc/php/etc
--with-config-file-scan-dir=/usr/etc/php/etc
--enable-fpm
--enable-zip
--enable-mysqlnd
--with-pdo-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-mysql=mysqlnd
--enable-re2c-cgoto
--with-libdir=/usr/etc/php/lib/php/extensions/no-debug-non-zts-20131226
[root@localhost php-5.6.7]# ./configure > --prefix=/usr/etc/php > --with-config-file-path=/usr/etc/php/etc > --with-config-file-scan-dir=/usr/etc/php/etc > --enable-fpm --enable-zip --enable-mysqlnd > --enable-zip > --enable-mysqlnd > --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd > --with-mysqli=mysqlnd > --with-mysql=mysqlnd > --enable-re2c-cgoto > --with-libdir=/usr/etc/php/lib/php/extensions/no-debug-non-zts-20131226 checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking how to run the C preprocessor... cc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking whether ln -s works... yes checking for system library directory... /usr/etc/php/lib/php/extensions/no-debug-non-zts-20131226 checking whether to enable runpaths... yes checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking for gawk... gawk checking for bison... bison -y checking for bison version... 2.7 (ok) checking for re2c... re2c checking for re2c version... 0.14.2 (ok) checking whether to enable computed goto gcc extension with re2c... yes checking whether re2c -g works... yes checking whether to force non-PIC code in shared modules... no checking whether /dev/urandom exists... yes checking for pthreads_cflags... -pthread checking for pthreads_lib... Configuring SAPI modules checking for AOLserver support... no checking for Apache 1.x module support via DSO through APXS... no checking for Apache 1.x module support... no checking whether to enable Apache charset compatibility option... no checking for Apache 2.0 filter-module support via DSO through APXS... no checking for Apache 2.0 handler-module support via DSO through APXS... no checking for Apache 1.x (hooks) module support via DSO through APXS... no checking for Apache 1.x (hooks) module support... no checking whether to enable Apache charset compatibility option... no checking for Caudium support... no checking for setproctitle... no checking sys/pstat.h usability... no checking sys/pstat.h presence... no checking for sys/pstat.h... no checking for PS_STRINGS... no checking for CLI build... yes checking for Continuity support... no checking for embedded SAPI library support... no checking for FPM build... yes checking for setenv... yes checking for clearenv... yes checking for setproctitle... (cached) no checking for library containing socket... none required checking for library containing inet_addr... none required checking errno.h usability... yes checking errno.h presence... yes checking for errno.h... yes checking fcntl.h usability... yes checking fcntl.h presence... yes checking for fcntl.h... yes checking stdio.h usability... yes checking stdio.h presence... yes checking for stdio.h... yes checking for stdlib.h... (cached) yes checking for unistd.h... (cached) yes checking sys/uio.h usability... yes checking sys/uio.h presence... yes checking for sys/uio.h... yes checking sys/select.h usability... yes checking sys/select.h presence... yes checking for sys/select.h... yes checking sys/socket.h usability... yes checking sys/socket.h presence... yes checking for sys/socket.h... yes checking sys/time.h usability... yes checking sys/time.h presence... yes checking for sys/time.h... yes checking arpa/inet.h usability... yes checking arpa/inet.h presence... yes checking for arpa/inet.h... yes checking netinet/in.h usability... yes checking netinet/in.h presence... yes checking for netinet/in.h... yes checking sysexits.h usability... yes checking sysexits.h presence... yes checking for sysexits.h... yes checking for prctl... yes checking for clock_gettime... yes checking for ptrace... yes checking whether ptrace works... yes checking for proc mem file... mem checking if gcc supports __sync_bool_compare_and_swap... yes checking for TCP_INFO... yes checking for sysconf... yes checking for times... yes checking for kqueue... no checking for port framework... no checking for /dev/poll... no checking for epoll... yes checking for poll... yes checking for select... yes checking for apparmor... no checking for Zeus ISAPI support... no checking for LiteSpeed support... no checking for Milter support... no checking for NSAPI support... no checking for phpdbg support... no checking for phpdbg debug build... no checking for PHTTPD support... no checking for Pi3Web support... no checking whether Roxen module is build using ZTS... no checking for Roxen/Pike support... checking for thttpd... no checking for TUX... no checking for webjames... no checking for CGI build... yes checking for socklen_t in sys/socket.h... yes checking for sun_len in sys/un.h... no checking whether cross-process locking is required by accept()... no checking for chosen SAPI module... none checking for executable SAPI binaries... cli fpm cgi Running system checks checking for sendmail... /usr/sbin/sendmail checking whether system uses EBCDIC... no checking whether byte ordering is bigendian... no checking whether writing to stdout works... This is the test message -- yes checking for socket... yes checking for socketpair... yes checking for htonl... yes checking for gethostname... yes checking for gethostbyaddr... yes checking for yp_get_default_domain... no checking for __yp_get_default_domain... no checking for yp_get_default_domain in -lnsl... yes checking for dlopen... no checking for __dlopen... no checking for dlopen in -ldl... yes checking for sin in -lm... yes checking for inet_aton... yes checking for ANSI C header files... (cached) yes checking for dirent.h that defines DIR... yes checking for library containing opendir... none required checking for inttypes.h... (cached) yes checking for stdint.h... (cached) yes checking for dirent.h... yes checking for ApplicationServices/ApplicationServices.h... no checking for sys/param.h... yes checking for sys/types.h... (cached) yes checking for sys/time.h... (cached) yes checking for netinet/in.h... (cached) yes checking for alloca.h... yes checking for arpa/inet.h... (cached) yes checking for arpa/nameser.h... yes checking for assert.h... yes checking for crypt.h... yes checking for dns.h... no checking for fcntl.h... (cached) yes checking for grp.h... yes checking for ieeefp.h... no checking for langinfo.h... yes checking for limits.h... yes checking for locale.h... yes checking for monetary.h... yes checking for netdb.h... yes checking for pwd.h... yes checking for resolv.h... yes checking for signal.h... yes checking for stdarg.h... yes checking for stdlib.h... (cached) yes checking for string.h... (cached) yes checking for syslog.h... yes checking for sysexits.h... (cached) yes checking for sys/ioctl.h... yes checking for sys/file.h... yes checking for sys/mman.h... yes checking for sys/mount.h... yes checking for sys/poll.h... yes checking for sys/resource.h... yes checking for sys/select.h... (cached) yes checking for sys/socket.h... (cached) yes checking for sys/stat.h... (cached) yes checking for sys/statfs.h... yes checking for sys/statvfs.h... yes checking for sys/vfs.h... yes checking for sys/sysexits.h... no checking for sys/varargs.h... no checking for sys/wait.h... yes checking for sys/loadavg.h... no checking for termios.h... yes checking for unistd.h... (cached) yes checking for unix.h... no checking for utime.h... yes checking for sys/utsname.h... yes checking for sys/ipc.h... yes checking for dlfcn.h... yes checking for assert.h... (cached) yes checking for fopencookie... yes checking for broken getcwd... no checking for broken libc stdio... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for struct tm.tm_zone... yes checking for missing declarations of reentrant functions... done checking for fclose declaration... ok checking for tm_gmtoff in struct tm... yes checking for struct flock... yes checking for socklen_t... yes checking size of size_t... 8 checking size of long long... 8 checking size of long long int... 8 checking size of long... 8 checking size of int... 4 checking size of intmax_t... 8 checking size of ssize_t... 8 checking size of ptrdiff_t... 8 checking size of short... 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... (cached) 8 checking for int8... no checking for int16... no checking for int32... no checking for int64... no checking for int8_t... yes checking for int16_t... yes checking for int32_t... yes checking for int64_t... yes checking for uint8... no checking for uint16... no checking for uint32... no checking for uint64... no checking for uint8_t... yes checking for uint16_t... yes checking for uint32_t... yes checking for uint64_t... yes checking for u_int8_t... yes checking for u_int16_t... yes checking for u_int32_t... yes checking for u_int64_t... yes checking for struct stat.st_blksize... yes checking for struct stat.st_blocks... yes checking for struct stat.st_rdev... yes checking for size_t... yes checking for uid_t in sys/types.h... yes checking for struct sockaddr_storage... yes checking for field sa_len in struct sockaddr... no checking for IPv6 support... yes checking for vprintf... yes checking for _doprnt... no checking for alphasort... yes checking for asctime_r... yes checking for chroot... yes checking for ctime_r... yes checking for cuserid... yes checking for crypt... no checking for flock... yes checking for ftok... yes checking for funopen... no checking for gai_strerror... yes checking for gcvt... yes checking for getloadavg... yes checking for getlogin... yes checking for getprotobyname... yes checking for getprotobynumber... yes checking for getservbyname... yes checking for getservbyport... yes checking for gethostname... (cached) yes checking for getrusage... yes checking for gettimeofday... yes checking for gmtime_r... yes checking for getpwnam_r... yes checking for getgrnam_r... yes checking for getpwuid_r... yes checking for grantpt... yes checking for inet_ntoa... yes checking for inet_ntop... yes checking for inet_pton... yes checking for isascii... yes checking for link... yes checking for localtime_r... yes checking for lockf... yes checking for lchown... yes checking for lrand48... yes checking for memcpy... yes checking for memmove... yes checking for mkstemp... yes checking for mmap... yes checking for nl_langinfo... yes checking for perror... yes checking for poll... yes checking for ptsname... yes checking for putenv... yes checking for realpath... yes checking for random... yes checking for rand_r... yes checking for scandir... yes checking for setitimer... yes checking for setlocale... yes checking for localeconv... yes checking for setenv... (cached) yes checking for setpgid... yes checking for setsockopt... yes checking for setvbuf... yes checking for shutdown... yes checking for sin... yes checking for snprintf... yes checking for srand48... yes checking for srandom... yes checking for statfs... yes checking for statvfs... yes checking for std_syslog... no checking for strcasecmp... yes checking for strcoll... yes checking for strdup... yes checking for strerror... yes checking for strftime... yes checking for strnlen... yes checking for strptime... yes checking for strstr... yes checking for strtok_r... yes checking for symlink... yes checking for tempnam... yes checking for tzset... yes checking for unlockpt... yes checking for unsetenv... yes checking for usleep... yes checking for utime... yes checking for vsnprintf... yes checking for vasprintf... yes checking for asprintf... yes checking for nanosleep... yes checking for nanosleep in -lrt... yes checking for getaddrinfo... yes checking for __sync_fetch_and_add... yes checking for strlcat... no checking for strlcpy... no checking for getopt... yes checking for utime.h... (cached) yes checking whether utime accepts a null argument... yes checking for working alloca.h... yes checking for alloca... yes checking for declared timezone... yes checking for type of reentrant time-related functions... POSIX checking for readdir_r... yes checking for type of readdir_r... POSIX checking for in_addr_t... yes checking for crypt_r... no General settings checking whether to include gcov symbols... no checking whether to include debugging symbols... no checking layout of installed files... PHP checking path to configuration file... /usr/etc/php/etc checking where to scan for configuration files... /usr/etc/php/etc checking whether to enable PHP's own SIGCHLD handler... no checking whether to explicitly link against libgcc... no checking whether to enable short tags by default... yes checking whether to enable dmalloc... no checking whether to enable IPv6 support... yes checking whether to enable DTrace support... no checking how big to make fd sets... using system default Configuring extensions checking size of long... (cached) 8 checking size of int... (cached) 4 checking for int32_t... yes checking for uint32_t... yes checking for sys/types.h... (cached) yes checking for inttypes.h... (cached) yes checking for stdint.h... (cached) yes checking for string.h... (cached) yes checking for stdlib.h... (cached) yes checking for strtoll... yes checking for atoll... yes checking for strftime... (cached) yes checking which regex library to use... php checking whether to enable LIBXML support... yes checking libxml2 install dir... no checking for xml2-config path... /usr/bin/xml2-config checking whether libxml build works... yes checking for OpenSSL support... no checking for Kerberos support... no checking whether to use system default cipher list instead of hardcoded value... no checking for PCRE library to use... bundled checking whether to enable the SQLite3 extension... yes checking bundled sqlite3 library... yes checking for ZLIB support... no checking if the location of ZLIB install directory is defined... no checking whether to enable bc style precision math functions... no checking for BZip2 support... no checking whether to enable calendar conversion support... no checking whether to enable ctype functions... yes checking for cURL support... no checking for QDBM support... no checking for GDBM support... no checking for NDBM support... no checking for TCADB support... no checking for Berkeley DB4 support... no checking for Berkeley DB3 support... no checking for Berkeley DB2 support... no checking for DB1 support... no checking for DBM support... no checking for CDB support... no checking for INI File support... no checking for FlatFile support... no checking whether to enable DBA interface... no checking whether to enable DOM support... yes checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking for ENCHANT support... no checking whether to enable EXIF (metadata from images) support... no checking for fileinfo support... yes checking for strcasestr... yes checking for utimes... yes checking for strndup... yes checking whether to enable input filter support... yes checking pcre install prefix... no checking whether to enable FTP support... no checking OpenSSL dir for FTP... no checking for GD support... no checking for the location of libvpx... no checking for the location of libjpeg... no checking for the location of libpng... no checking for the location of libXpm... no checking for FreeType 2... no checking for T1lib support... no checking whether to enable truetype string function in GD... no checking whether to enable JIS-mapped Japanese font support in GD... no checking for GNU gettext support... no checking for GNU MP support... no checking for mhash support... no checking whether to enable hash support... yes checking whether byte ordering is bigendian... (cached) no checking size of short... (cached) 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... (cached) 8 checking for iconv support... yes checking for iconv... yes checking if iconv is glibc's... yes checking if iconv supports errno... yes checking if your cpp allows macro usage in include lines... yes checking for IMAP support... no checking for IMAP Kerberos support... no checking for IMAP SSL support... no checking for InterBase support... no checking whether to enable internationalization support... no checking whether to enable JavaScript Object Serialization support... yes checking for ANSI C header files... (cached) yes checking for LDAP support... no checking for LDAP Cyrus SASL support... no checking whether to enable multibyte string support... no checking whether to enable multibyte regex support... yes checking whether to check multibyte regex backtrack... yes checking for external libmbfl... no checking for external oniguruma... no checking for mcrypt support... no checking for MSSQL support via FreeTDS... no checking for MySQL support... yes checking for specified location of the MySQL UNIX socket... no checking for MySQL UNIX socket location... no checking for MySQLi support... yes checking whether to enable embedded MySQLi support... no checking for Oracle Database OCI8 support... no checking whether to enable Zend OPcache support... yes checking for mprotect... yes checking for sysvipc shared memory support... yes checking for mmap() using MAP_ANON shared memory support... yes checking for mmap() using /dev/zero shared memory support... yes checking for mmap() using shm_open() shared memory support... yes checking for mmap() using regular file shared memory support... yes checking "whether flock struct is linux ordered"... "yes" checking "whether flock struct is BSD ordered"... "no" checking whether to enable pcntl support... no checking whether to enable PDO support... yes checking for PDO_DBLIB support via FreeTDS... no checking for Firebird support for PDO... no checking for MySQL support for PDO... yes checking for PDO includes... checking for PDO includes... /usr/local/bin/php-5.6.7/ext checking Oracle OCI support for PDO... no checking for ODBC v3 support for PDO... no checking for PostgreSQL support for PDO... no checking for sqlite 3 support for PDO... yes checking for PDO includes... (cached) /usr/local/bin/php-5.6.7/ext checking for usleep... (cached) yes checking for nanosleep... (cached) yes checking time.h usability... yes checking time.h presence... yes checking for time.h... yes checking for fdatasync in -lrt... yes checking for PostgreSQL support... no checking for phar archive support... yes checking for phar openssl support... no checking whether to enable POSIX-like functions... yes checking sys/mkdev.h usability... no checking sys/mkdev.h presence... no checking for sys/mkdev.h... no checking for seteuid... yes checking for setegid... yes checking for setsid... yes checking for getsid... yes checking for setpgid... (cached) yes checking for getpgid... yes checking for ctermid... yes checking for mkfifo... yes checking for mknod... yes checking for getrlimit... yes checking for getlogin... (cached) yes checking for getgroups... yes checking for makedev... no checking for initgroups... yes checking for getpwuid_r... (cached) yes checking for getgrgid_r... yes checking for working ttyname_r() implementation... no, posix_ttyname() will be thread-unsafe checking for utsname.domainname... yes checking for PSPELL support... no checking for libedit readline replacement... no checking for readline support... no checking for recode support... no checking whether to enable PHP sessions... yes checking for mm support... no checking whether pwrite works... yes checking whether pread works... yes checking whether to enable shmop support... no checking whether to enable SimpleXML support... yes checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking for SNMP support... no checking OpenSSL dir for SNMP... no checking whether to enable SOAP support... no checking whether to enable sockets support... no checking whether zend_object_value is packed... no checking whether flush should be called explicitly after a buffered io... no checking for crypt in -lcrypt... yes checking for standard DES crypt... yes checking for extended DES crypt... no checking for MD5 crypt... yes checking for Blowfish crypt... no checking for SHA512 crypt... yes checking for SHA256 crypt... yes checking whether the compiler supports __alignof__... yes checking whether the compiler supports aligned attribute... yes checking for getcwd... yes checking for getwd... yes checking for asinh... yes checking for acosh... yes checking for atanh... yes checking for log1p... yes checking for hypot... yes checking for glob... yes checking for strfmon... yes checking for nice... yes checking for fpclass... no checking for isinf... yes checking for isnan... yes checking for mempcpy... yes checking for strpncpy... no checking for working POSIX fnmatch... yes checking for fork... yes checking if your OS can spawn processes with inherited handles... yes checking for res_nsearch... no checking for __res_nsearch... no checking for res_nsearch in -lresolv... no checking for __res_nsearch in -lresolv... yes checking for dns_search... no checking for __dns_search... no checking for dns_search in -lresolv... no checking for __dns_search in -lresolv... no checking for dns_search in -lbind... no checking for __dns_search in -lbind... no checking for dns_search in -lsocket... no checking for __dns_search in -lsocket... no checking for dn_expand... no checking for __dn_expand... yes checking for dn_skipname... no checking for __dn_skipname... yes checking for res_search... no checking for __res_search... yes checking whether atof() accepts NAN... yes checking whether atof() accepts INF... yes checking whether HUGE_VAL == INF... yes checking whether HUGE_VAL + -HUGEVAL == NAN... yes checking whether strptime() declaration fails... yes checking wchar.h usability... yes checking wchar.h presence... yes checking for wchar.h... yes checking for mblen... yes checking for mbrlen... yes checking for mbsinit... yes checking for mbstate_t... yes checking atomic.h usability... no checking atomic.h presence... no checking for atomic.h... no checking for Sybase-CT support... no checking whether to enable System V IPC support... no checking whether to enable System V semaphore support... no checking whether to enable System V shared memory support... no checking for TIDY support... no checking whether to enable tokenizer support... yes checking whether to enable WDDX support... no checking libexpat dir for WDDX... no checking whether to enable XML support... yes checking libexpat install dir... no checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking whether to enable XMLReader support... yes checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking for XMLRPC-EPI support... no checking libexpat dir for XMLRPC-EPI... no checking iconv dir for XMLRPC-EPI... no checking whether to enable XMLWriter support... yes checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking for XSL support... no checking for zip archive read/writesupport... yes checking pcre install prefix... no checking libzip... no checking for the location of zlib... /usr checking for int8_t... (cached) yes checking for int16_t... (cached) yes checking for int32_t... (cached) yes checking for int64_t... (cached) yes checking for uint8_t... (cached) yes checking for uint16_t... (cached) yes checking for uint32_t... (cached) yes checking for uint64_t... (cached) yes checking for ssize_t... yes checking size of short... (cached) 2 checking size of int... (cached) 4 checking size of long... (cached) 8 checking size of long long... (cached) 8 checking size of off_t... 8 checking size of size_t... (cached) 8 checking for touch... /usr/bin/touch checking for unzip... no checking for struct tm.tm_zone... (cached) yes checking whether to enable mysqlnd... yes checking whether to disable compressed protocol support in mysqlnd... yes Configuring PEAR checking whether to install PEAR... yes Configuring Zend checking for bison version... (cached) 2.7 (ok) checking for inttypes.h... (cached) yes checking for stdint.h... (cached) yes checking for limits.h... (cached) yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking for stdarg.h... (cached) yes checking for sys/types.h... (cached) yes checking for sys/time.h... (cached) yes checking for signal.h... (cached) yes checking for unix.h... (cached) no checking for stdlib.h... (cached) yes checking for dlfcn.h... (cached) yes checking for size_t... (cached) yes checking return type of signal handlers... void checking for uint... yes checking for ulong... yes checking for int32_t... yes checking for uint32_t... yes checking for vprintf... (cached) yes checking for _doprnt... (cached) no checking for working memcmp... yes checking for working alloca.h... (cached) yes checking for alloca... (cached) yes checking for memcpy... (cached) yes checking for strdup... (cached) yes checking for getpid... yes checking for kill... yes checking for strtod... yes checking for strtol... yes checking for finite... yes checking for fpclass... (cached) no checking for sigsetjmp... no checking whether sprintf is broken... no checking for finite... (cached) yes checking for isfinite... no checking for isinf... (cached) yes checking for isnan... (cached) yes checking whether fp_except is defined... no checking for usable _FPU_SETCW... yes checking for usable fpsetprec... no checking for usable _controlfp... no checking for usable _controlfp_s... no checking whether FPU control word can be manipulated by inline assembler... yes checking whether double cast to long preserves least significant bits... no checking for dlfcn.h... (cached) yes checking whether dlsym() requires a leading underscore in symbol names... no checking virtual machine dispatch method... CALL checking whether to enable thread-safety... no checking whether to enable inline optimization for GCC... yes checking whether to enable Zend debugging... no checking for inline... inline checking target system is Darwin... no checking for MM alignment and log values... done checking for memory allocation using mmap(MAP_ANON)... yes checking for memory allocation using mmap("/dev/zero")... yes checking for mremap... yes checking for sigaction... yes checking whether to enable zend signal handling... no Configuring TSRM checking for stdarg.h... (cached) yes checking for sigprocmask... yes Configuring libtool checking for ld used by cc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognize dependent libraries... pass_all checking the maximum length of command line arguments... 1572864 checking command to parse /usr/bin/nm -B output from cc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if cc supports -fno-rtti -fno-exceptions... no checking for cc option to produce PIC... -fPIC checking if cc PIC flag -fPIC works... yes checking if cc static flag -static works... no checking if cc supports -c -o file.o... yes checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes creating libtool appending configuration tag "CXX" to libtool Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php5.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: main/php_config.h is unchanged config.status: executing default commands
make make install
[root@localhost php-5.6.7]# make install Installing shared extensions: /usr/etc/php/lib/php/extensions/no-debug-non-zts-20131226/ Installing PHP CLI binary: /usr/etc/php/bin/ Installing PHP CLI man page: /usr/etc/php/php/man/man1/ Installing PHP FPM binary: /usr/etc/php/sbin/ Installing PHP FPM config: /usr/etc/php/etc/ Installing PHP FPM man page: /usr/etc/php/php/man/man8/ Installing PHP FPM status page: /usr/etc/php/php/php/fpm/ Installing PHP CGI binary: /usr/etc/php/bin/ Installing PHP CGI man page: /usr/etc/php/php/man/man1/ Installing build environment: /usr/etc/php/lib/php/build/ Installing header files: /usr/etc/php/include/php/ Installing helper programs: /usr/etc/php/bin/ program: phpize program: php-config Installing man pages: /usr/etc/php/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/etc/php/lib/php/ [PEAR] Archive_Tar - already installed: 1.3.12 [PEAR] Console_Getopt - already installed: 1.3.1 [PEAR] Structures_Graph- already installed: 1.0.4 [PEAR] XML_Util - already installed: 1.2.3 [PEAR] PEAR - already installed: 1.9.5 Wrote PEAR system config file at: /usr/etc/php/etc/pear.conf You may want to add: /usr/etc/php/lib/php to your php.ini include_path /usr/local/bin/php-5.6.7/build/shtool install -c ext/phar/phar.phar /usr/etc/php/bin ln -s -f /usr/etc/php/bin/phar.phar /usr/etc/php/bin/phar Installing PDO headers: /usr/etc/php/include/php/ext/pdo/
配置php.ini
复制php.ini到安装目录 /usr/etc/php/etc/php.ini 当前目录/usr/local/bin/php-5.6.7
[root@localhost php-5.6.7]# cp php.ini-production /usr/etc/php/etc/php.ini [root@localhost php-5.6.7]# cd /usr/etc/php/etc [root@localhost etc]# ls pear.conf php.ini
vi php.ini 目录:/usr/etc/php/etc
[root@localhost etc]# vi php.ini
修改的地方 vi 命令行/timezone 向下查找( / ) ( ? 向上查找 )
date.timezone = PRC
配置php-fpm.conf
[root@localhost php-5.6.7]# cd /usr/etc/php/etc [root@localhost etc]# ls pear.conf php-fpm.conf.default php.ini [root@localhost etc]# cp php-fpm.conf.default php-fpm.conf [root@localhost etc]# ls pear.conf php-fpm.conf php-fpm.conf.default php.ini
[root@localhost etc]# vi php-fpm.conf
user = www #设置php-fpm运行账号为www group = www #设置php-fpm运行组为www pid = run/php-fpm.pid #取消前面的分号
添加用户组 和用户 www
[root@localhost etc]# useradd www [root@localhost etc]# groupadd www groupadd:“www”组已存在 [root@localhost etc]#
查看用户组 和用户
[root@localhost etc]# cut -d : -f 1 /etc/group root bin daemon sys adm tty disk lp mem kmem wheel cdrom mail man dialout floppy games tape video ftp lock audio nobody users utmp utempter ssh_keys systemd-journal dbus polkitd avahi avahi-autoipd dip postdrop postfix sshd www
查看用户
[root@localhost etc]# cut -d : -f 1 /etc/passwd root bin daemon adm lp sync shutdown halt mail operator games ftp nobody dbus polkitd avahi avahi-autoipd postfix sshd www
启动php-fpm
[root@localhost ~]# cd /usr/etc/php/sbin [root@localhost sbin]# ls php-fpm [root@localhost sbin]# ./php-fpm
检测是否启动
[root@localhost sbin]# lsof -i:9000 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME php-fpm 2034 root 7u IPv4 18742 0t0 TCP localhost:cslistener (LISTEN) php-fpm 2035 www 0u IPv4 18742 0t0 TCP localhost:cslistener (LISTEN) php-fpm 2036 www 0u IPv4 18742 0t0 TCP localhost:cslistener (LISTEN)
开机自启动php-fpm
复制php-fpm到启动目录/etc/init.d
[root@localhost fpm]# cp /usr/etc/php/sbin/php-fpm /etc/init.d/php-fpm
给予权限
[root@localhost sbin]# chmod 755 /etc/init.d/php-fpm
添加服务
[root@localhost init.d]# chkconfig --add php-fpm
开机启动 开启
[root@localhost init.d]# chkconfig php-fpm on
查看权限
[root@localhost sbin]# ll /etc/init.d/php-fpm -rwxr-xr-x. 1 root root 2352 4月 10 17:06 /etc/init.d/php-fpm
查看开机服务列表
[root@localhost init.d]# chkconfig --list 注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。 欲查看对特定 target 启用的服务请执行 'systemctl list-dependencies [target]'。 denyhosts 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprdump 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprinit 0:关 1:关 2:开 3:开 4:开 5:开 6:关 iprupdate 0:关 1:关 2:开 3:开 4:开 5:开 6:关 mysql 0:关 1:关 2:开 3:开 4:开 5:开 6:关 netconsole 0:关 1:关 2:关 3:关 4:关 5:关 6:关 network 0:关 1:关 2:开 3:开 4:开 5:开 6:关 php-fpm 0:关 1:关 2:开 3:开 4:开 5:开 6:关
配置nginx文件 支持php
/usr/etc/nginx/conf/nginx.conf
进入nginx安装目录 下的conf目录的nginx.conf文件
vi nginx.conf 默认配置
[root@localhost conf]# vi nginx.conf #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #
添加php支持 nginx
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm index.php ;
}
去掉前面的#号
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
esc - :wq - 回车
建立测试index.php
进入nginx安装目录的html目录
本例 地址 cd /usr/etc/nginx/html
新建index.php
[root@localhost html]# vi index.php
按 i 插入 输入
<?php
phpinfo();
?>
esc 退出到命令行 :wq 保存退出
常用的 php环境提供的 模块参考
bcmath bz2 calendar cgi-fcgi Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext hash json
mbstring mcrypt mhash mysql mysqli mysqlnd odbc pcre PDO pdo_mysql pdo_sqlsrv Phar Reflection session SimpleXML iconv libxml
SPL sqlsrv standard tokenizer wddx xmlreader xmlwriter zip zlib
红色大概也是需要的~ 大概~ 凭感觉了~
mysqlnd 介绍 官方文档
编译mysqli扩展前 先提前编译mysqlnd mysql mysqli pdo_mysql 都可以链接这个自然驱动
mysql,mysqli以及PDO Mysql驱动都可以各自配置使用 libmysql或者mysqlnd。mysqlnd作为一个专门设计 用于PHP系统的库,它在内存和速度上都比libmysql有很大提升。非常希望你去尝试这些提升。
http://php.net/manual/zh/mysqli.overview.php#mysqli.overview.mysqlnd
nginx 启动 重启 停止
进入安装目录/usr/etc/nginx/sbin
检测配置文件是否正确
./nginx -t
[root@localhost sbin]# ./nginx -t nginx: the configuration file /usr/etc/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/etc/nginx/conf/nginx.conf test is successful
执行重启命令
[root@localhost sbin]# ./nginx -s reload
启动nginx
[root@localhost sbin]# ./nginx
停止nginx
[root@localhost sbin]# ./nginx -s stop
同时php-fpm也要启动(安装目录下的/usr/etc/php/etc/php-fpm启动) 正常显示phpinfo()页面