LAMP之PHP
保持apache、mysql正在运行
[root@cairui php-7.2.]# lsof -i tcp:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
AliYunDun root 18u IPv4 0t0 TCP 120.25.255.87:->106.11.68.13:http (ESTABLISHED)
httpd root 3u IPv4 0t0 TCP *:http (LISTEN)
httpd daemon 3u IPv4 0t0 TCP *:http (LISTEN)
httpd daemon 3u IPv4 0t0 TCP *:http (LISTEN)
[root@cairui php-7.2.]# lsof -i tcp:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld mysql 29u IPv4 0t0 TCP *:mysql (LISTEN)
依赖的库
[root@Centos tools]# yum install zlib libxml libjpeg freetype libpng gd curl libiconv Zlib-devel libxml2-evel
libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
安装libiconv库
[root@cairui php-7.2.]# wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
[root@cairui php-7.2.]# ./configure --prefix=/opt/libiconv
安装php
[root@cairui php-7.2.]# tar zxf php-7.2..tar.gz
[root@cairui php-7.2.]# ./configure --help
`configure' configures this package to adapt to many kinds of systems. Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..'] Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX] By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR] System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST] Optional Features and Packages:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-libdir=NAME Look for libraries in .../NAME rather than .../lib
--disable-rpath Disable passing additional runtime library
search paths
--enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension
--disable-gcc-global-regs
whether to enable GCC global register variables SAPI modules: --with-apxs2=FILE Build shared Apache 2.0 Handler module. FILE is the optional
pathname to the Apache apxs tool apxs
--disable-cli Disable building CLI version of PHP
(this forces --without-pear)
--enable-embed=TYPE EXPERIMENTAL: Enable building of embedded SAPI library
TYPE is either 'shared' or 'static'. TYPE=shared
--enable-fpm Enable building of the fpm SAPI executable
--with-fpm-user=USER Set the user for php-fpm to run as. (default: nobody)
--with-fpm-group=GRP Set the group for php-fpm to run as. For a system user, this
should usually be set to match the fpm username (default: nobody)
--with-fpm-systemd Activate systemd integration
--with-fpm-acl Use POSIX Access Control Lists
--with-litespeed Build PHP as litespeed module
--enable-phpdbg Build phpdbg
--enable-phpdbg-webhelper Build phpdbg web SAPI support
--enable-phpdbg-debug Build phpdbg in debug mode
--disable-cgi Disable building CGI version of PHP General settings: --enable-gcov Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!
--enable-debug Compile with debugging symbols
--with-layout=TYPE Set how installed files will be laid out. Type can
be either PHP or GNU [PHP]
--with-config-file-path=PATH
Set the path in which to look for php.ini [PREFIX/lib]
--with-config-file-scan-dir=PATH
Set the path where to scan for configuration files
--enable-sigchild Enable PHP's own SIGCHLD handler
--enable-libgcc Enable explicitly linking against libgcc
--disable-short-tags Disable the short-form <? start tag by default
--enable-dmalloc Enable dmalloc
--disable-ipv6 Disable IPv6 support
--enable-dtrace Enable DTrace support
--enable-fd-setsize Set size of descriptor sets Extensions: --with-EXTENSION=shared[,PATH] NOTE: Not all extensions can be build as 'shared'. Example: --with-foobar=shared,/usr/local/foobar/ o Builds the foobar extension as shared extension.
o foobar package install prefix is /usr/local/foobar/ --disable-all Disable all extensions which are enabled by default --disable-libxml Disable LIBXML support
--with-libxml-dir=DIR LIBXML: libxml2 install prefix
--with-openssl=DIR Include OpenSSL support (requires OpenSSL >= 1.0.1)
--with-kerberos=DIR OPENSSL: Include Kerberos support
--with-system-ciphers OPENSSL: Use system default cipher list instead of hardcoded value
--with-pcre-regex=DIR Include Perl Compatible Regular Expressions support.
DIR is the PCRE install prefix BUNDLED
--with-pcre-jit Enable PCRE JIT functionality (BUNDLED only)
--with-pcre-valgrind=DIR
Enable PCRE valgrind support. Developers only!
--without-sqlite3=DIR Do not include SQLite3 support. DIR is the prefix to
SQLite3 installation directory.
--with-zlib=DIR Include ZLIB support (requires zlib >= 1.0.9)
--with-zlib-dir=<DIR> Define the location of zlib install directory
--enable-bcmath Enable bc style precision math functions
--with-bz2=DIR Include BZip2 support
--enable-calendar Enable support for calendar conversion
--disable-ctype Disable ctype functions
--with-curl=DIR Include cURL support
--enable-dba Build DBA with bundled modules. To build shared DBA
extension use --enable-dba=shared
--with-qdbm=DIR DBA: QDBM support
--with-gdbm=DIR DBA: GDBM support
--with-ndbm=DIR DBA: NDBM support
--with-db4=DIR DBA: Oracle Berkeley DB .x or .x support
--with-db3=DIR DBA: Oracle Berkeley DB .x support
--with-db2=DIR DBA: Oracle Berkeley DB .x support
--with-db1=DIR DBA: Oracle Berkeley DB .x support/emulation
--with-dbm=DIR DBA: DBM support
--with-tcadb=DIR DBA: Tokyo Cabinet abstract DB support
--with-lmdb=DIR DBA: Lightning memory-mapped database support
--without-cdb=DIR DBA: CDB support (bundled)
--disable-inifile DBA: INI support (bundled)
--disable-flatfile DBA: FlatFile support (bundled)
--disable-dom Disable DOM support
--with-libxml-dir=DIR DOM: libxml2 install prefix
--with-enchant=DIR Include enchant support.
GNU Aspell version 1.1. or higher required.
--enable-exif Enable EXIF (metadata from images) support
--disable-fileinfo Disable fileinfo support
--disable-filter Disable input filter support
--with-pcre-dir FILTER: pcre install prefix
--enable-ftp Enable FTP support
--with-openssl-dir=DIR FTP: openssl install prefix
--with-gd=DIR Include GD support. DIR is the GD library base
install directory BUNDLED
--with-webp-dir=DIR GD: Set the path to libwebp install prefix
--with-jpeg-dir=DIR GD: Set the path to libjpeg install prefix
--with-png-dir=DIR GD: Set the path to libpng install prefix
--with-zlib-dir=DIR GD: Set the path to libz install prefix
--with-xpm-dir=DIR GD: Set the path to libXpm install prefix
--with-freetype-dir=DIR GD: Set the path to FreeType 2 install prefix
--enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support
--with-gettext=DIR Include GNU gettext support
--with-gmp=DIR Include GNU MP support
--with-mhash=DIR Include mhash support
--disable-hash Disable hash support
--without-iconv=DIR Exclude iconv support
--with-imap=DIR Include IMAP support. DIR is the c-client install prefix
--with-kerberos=DIR IMAP: Include Kerberos support. DIR is the Kerberos install prefix
--with-imap-ssl=DIR IMAP: Include SSL support. DIR is the OpenSSL install prefix
--with-interbase=DIR Include Firebird support. DIR is the Firebird base
install directory /opt/firebird
--enable-intl Enable internationalization support
--with-icu-dir=DIR Specify where ICU libraries and headers can be found
--disable-json Disable JavaScript Object Serialization support
--with-ldap=DIR Include LDAP support
--with-ldap-sasl=DIR LDAP: Include Cyrus SASL support
--enable-mbstring Enable multibyte string support
--disable-mbregex MBSTRING: Disable multibyte regex support
--disable-mbregex-backtrack
MBSTRING: Disable multibyte regex backtrack check
--with-libmbfl=DIR MBSTRING: Use external libmbfl. DIR is the libmbfl base
install directory BUNDLED
--with-onig=DIR MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
If DIR is not set, the bundled oniguruma will be used
--with-mysqli=FILE Include MySQLi support. FILE is the path
to mysql_config. If no value or mysqlnd is passed
as FILE, the MySQL native driver will be used
--enable-embedded-mysqli
MYSQLi: Enable embedded support
Note: Does not work with MySQL native driver!
--with-mysql-sock=SOCKPATH
MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched
--with-oci8=DIR Include Oracle Database OCI8 support. DIR defaults to $ORACLE_HOME.
Use --with-oci8=instantclient,/path/to/instant/client/lib
to use an Oracle Instant Client installation
--with-odbcver=HEX Force support for the passed ODBC version. A hex number is expected, default 0x0350.
Use the special value of to prevent an explicit ODBCVER to be defined.
--with-adabas=DIR Include Adabas D support /usr/local
--with-sapdb=DIR Include SAP DB support /usr/local
--with-solid=DIR Include Solid support /usr/local/solid
--with-ibm-db2=DIR Include IBM DB2 support /home/db2inst1/sqllib
--with-ODBCRouter=DIR Include ODBCRouter.com support /usr
--with-empress=DIR Include Empress support \$EMPRESSPATH
(Empress Version >= 8.60 required)
--with-empress-bcs=DIR
Include Empress Local Access support \$EMPRESSPATH
(Empress Version >= 8.60 required)
--with-birdstep=DIR Include Birdstep support /usr/local/birdstep
--with-custom-odbc=DIR Include user defined ODBC support. DIR is ODBC install base
directory /usr/local. Make sure to define CUSTOM_ODBC_LIBS and
have some odbc.h in your include dirs. f.e. you should define
following for Sybase SQL Anywhere 5.5. on QNX, prior to
running this configure script:
CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\"
LDFLAGS=-lunix
CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\"
--with-iodbc=DIR Include iODBC support /usr/local
--with-esoob=DIR Include Easysoft OOB support /usr/local/easysoft/oob/client
--with-unixODBC=DIR Include unixODBC support /usr/local
--with-dbmaker=DIR Include DBMaker support
--disable-opcache Disable Zend OPcache support
--disable-opcache-file Disable file based caching
--disable-huge-code-pages
Disable copying PHP CODE pages into HUGE PAGES
--enable-pcntl Enable pcntl support (CLI/CGI only)
--disable-pdo Disable PHP Data Objects support
--with-pdo-dblib=DIR PDO: DBLIB-DB support. DIR is the FreeTDS home directory
--with-pdo-firebird=DIR PDO: Firebird support. DIR is the Firebird base
install directory /opt/firebird
--with-pdo-mysql=DIR PDO: MySQL support. DIR is the MySQL base directory
If no value or mysqlnd is passed as DIR, the
MySQL native driver will be used
--with-zlib-dir=DIR PDO_MySQL: Set the path to libz install prefix
--with-pdo-oci=DIR PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME.
Use --with-pdo-oci=instantclient,/path/to/instant/client/lib
for an Oracle Instant Client installation.
--with-pdo-odbc=flavour,dir
PDO: Support for 'flavour' ODBC driver.
include and lib dirs are looked for under 'dir'. 'flavour' can be one of: ibm-db2, iODBC, unixODBC, generic
If ',dir' part is omitted, default for the flavour
you have selected will be used. e.g.: --with-pdo-odbc=unixODBC will check for unixODBC under /usr/local. You may attempt
to use an otherwise unsupported driver using the \"generic\"
flavour. The syntax for generic ODBC support is: --with-pdo-odbc=generic,dir,libname,ldflags,cflags When built as 'shared' the extension filename is always pdo_odbc.so
--with-pdo-pgsql=DIR PDO: PostgreSQL support. DIR is the PostgreSQL base
install directory or the path to pg_config
--without-pdo-sqlite=DIR
PDO: sqlite support. DIR is the sqlite base
install directory BUNDLED
--with-pgsql=DIR Include PostgreSQL support. DIR is the PostgreSQL
base install directory or the path to pg_config
--disable-phar Disable phar support
--disable-posix Disable POSIX-like functions
--with-pspell=DIR Include PSPELL support.
GNU Aspell version 0.50. or higher required
--with-libedit=DIR Include libedit readline replacement (CLI/CGI only)
--with-readline=DIR Include readline support (CLI/CGI only)
--with-recode=DIR Include recode support
--disable-session Disable session support
--with-mm=DIR SESSION: Include mm support for session storage
--enable-shmop Enable shmop support
--disable-simplexml Disable SimpleXML support
--with-libxml-dir=DIR SimpleXML: libxml2 install prefix
--with-snmp=DIR Include SNMP support
--with-openssl-dir=DIR SNMP: openssl install prefix
--enable-soap Enable SOAP support
--with-libxml-dir=DIR SOAP: libxml2 install prefix
--enable-sockets Enable sockets support
--with-sodium=DIR Include sodium support
--with-password-argon2=DIR Include Argon2 support in password_*. DIR is the Argon2 shared library path]
--enable-sysvmsg Enable sysvmsg support
--enable-sysvsem Enable System V semaphore support
--enable-sysvshm Enable the System V shared memory support
--with-tidy=DIR Include TIDY support
--disable-tokenizer Disable tokenizer support
--enable-wddx Enable WDDX support
--with-libxml-dir=DIR WDDX: libxml2 install prefix
--with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)
--disable-xml Disable XML support
--with-libxml-dir=DIR XML: libxml2 install prefix
--with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)
--disable-xmlreader Disable XMLReader support
--with-libxml-dir=DIR XMLReader: libxml2 install prefix
--with-xmlrpc=DIR Include XMLRPC-EPI support
--with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix
--with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)
--with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI
--disable-xmlwriter Disable XMLWriter support
--with-libxml-dir=DIR XMLWriter: libxml2 install prefix
--with-xsl=DIR Include XSL support. DIR is the libxslt base
install directory (libxslt >= 1.1. required)
--enable-zend-test Enable zend-test extension
--enable-zip Include Zip read/write support
--with-zlib-dir=DIR ZIP: Set the path to libz install prefix
--with-pcre-dir ZIP: pcre install prefix
--with-libzip=DIR ZIP: use libzip
--enable-mysqlnd Enable mysqlnd explicitly, will be done implicitly
when required by other extensions
--disable-mysqlnd-compression-support
Disable support for the MySQL compressed protocol in mysqlnd
--with-zlib-dir=DIR mysqlnd: Set the path to libz install prefix PEAR: --with-pear=DIR Install PEAR in DIR [PREFIX/lib/php]
--without-pear Do not install PEAR Zend: --enable-maintainer-zts Enable thread safety - for code maintainers only!!
--disable-inline-optimization
If building zend_execute.lo fails, try this switch
--disable-zend-signals whether to enable zend signal handling TSRM: --with-tsrm-pth=pth-config
Use GNU Pth
--with-tsrm-st Use SGI's State Threads
--with-tsrm-pthreads Use POSIX threads (default) Libtool: --enable-shared=PKGS Build shared libraries default=yes
--enable-static=PKGS Build static libraries default=yes
--enable-fast-install=PKGS
Optimize for fast installation default=yes
--with-gnu-ld Assume the C compiler uses GNU ld default=no
--disable-libtool-lock Avoid locking (might break parallel builds)
--with-pic Try to use only PIC/non-PIC objects default=use both
--with-tags=TAGS Include additional configurations automatic Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider.
PHP编译安装时常见错误解决办法,php编译常见错误 This article is post on https://coderwall.com/p/ggmpfa configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1. distribution
复制代码 代码如下:
yum -y install libxslt-devel configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
复制代码 代码如下:
yum -y install net-snmp-devel configure: error: Please reinstall readline - I cannot find readline.h
复制代码 代码如下:
yum -y install readline-devel configure: error: Cannot find pspell
复制代码 代码如下:
yum -y install aspell-devel checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!
复制代码 代码如下:
yum -y install unixODBC-devel configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.
复制代码 代码如下:
yum -y install libicu-devel configure: error: utf8mime2text() has new signature, but U8TCANONICAL is missing. This should not happen. Check config.log for additional information.
复制代码 代码如下:
yum -y install libc-client-devel configure: error: freetype.h not found.
复制代码 代码如下:
yum -y install freetype-devel configure: error: xpm.h not found.
复制代码 代码如下:
yum -y install libXpm-devel configure: error: png.h not found.
复制代码 代码如下:
yum -y install libpng-devel configure: error: vpx_codec.h not found.
复制代码 代码如下:
yum -y install libvpx-devel configure: error: Cannot find enchant
复制代码 代码如下:
yum -y install enchant-devel configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/
复制代码 代码如下:
yum -y install libcurl-devel LAOGAO added : configure: error: mcrypt.h not found. Please reinstall libmcrypt.
复制代码 代码如下:
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar zxf libmcrypt-2.5..tar.gz
cd libmcrypt-2.5.
./configure
make && make install added : Cannot find imap
复制代码 代码如下:
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.
复制代码 代码如下:
yum -y install libc-client-devel Cannot find ldap.h
复制代码 代码如下:
yum -y install openldap
yum -y install openldap-devel configure: error: Cannot find ldap libraries in /usr/lib
复制代码 代码如下:
cp -frp /usr/lib64/libldap* /usr/lib/ configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
复制代码 代码如下:
yum -y install postgresql-devel configure: error: Please reinstall the lib curl distribution
复制代码 代码如下:
yum -y install curl-devel configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
复制代码 代码如下:
yum -y install net-snmp-devel configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1. distribution
复制代码 代码如下:
yum -y install libxslt-devel checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution Fix:
复制代码 代码如下:
yum -y install bzip2-devel checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/ Fix:
复制代码 代码如下:
yum -y install curl-devel checking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s). Fix:
复制代码 代码如下:
yum -y install db4-devel checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found. Fix:
复制代码 代码如下:
yum -y install libjpeg-devel checking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found. Fix:
复制代码 代码如下:
yum -y install libpng-devel checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir= configure: error: freetype.h not found.
Fix:
复制代码 代码如下:
Reconfigure your PHP with the following option. --with-xpm-dir=/usr checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found. Fix:
复制代码 代码如下:
yum -y install libXpm-devel checking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.h Fix:
复制代码 代码如下:
yum -y install gmp-devel checking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information. Fix:
复制代码 代码如下:
yum -y install libc-client-devel checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.h Fix:
复制代码 代码如下:
yum -y install openldap-devel checking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found! Fix:
复制代码 代码如下:
yum -y install unixODBC-devel checking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path Fix:
复制代码 代码如下:
yum -y install postgresql-devel checking for sqlite support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3./ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distribution Fix:
复制代码 代码如下:
yum -y install sqlite-devel checking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspell Fix:
复制代码 代码如下:
yum -y install aspell-devel checking whether to enable UCD SNMP hack… yes checking for default_store.h… no checking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information. Fix:
复制代码 代码如下:
yum -y install net-snmp-devel checking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1. distribution Fix:
复制代码 代码如下:
yum -y install libxslt-devel configure: error: xml2-config not found. Please check your libxml2 installation. Fix:
复制代码 代码如下:
yum -y install libxml2-devel checking for PCRE headers location… configure: error: Could not find pcre.h in /usr Fix:
复制代码 代码如下:
yum -y install pcre-devel configure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore! Fix:
复制代码 代码如下:
yum -y install mysql-devel checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h' not found! Fix:
复制代码 代码如下:
yum -y install unixODBC-devel checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path Fix:
复制代码 代码如下:
yum -y install postgresql-devel configure: error: Cannot find pspell Fix:
复制代码 代码如下:
yum -y install pspell-devel configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation. Fix:
复制代码 代码如下:
yum -y install net-snmp-devel configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1. distribution Fix:
复制代码 代码如下:
yum -y install libxslt-devel
编译参数
[root@cairui php-7.2.3]# ./configure --prefix=/opt/php7.2.3 --with-apxs2=/opt/apache/bin/apxs --with-openssl --with-zlib --with-curl --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-libxml-dir --enable-soap --enable-sockets --with-xmlrpc --with-iconv-dir=/opt/libiconv --with-xsl --with-mysqli --with-pdo-mysql --with-mysqli
PHP中三种主要的MySQL连接方式(.4开始驱动底层实现都是mysqlnd):
http://php.net/manual/zh/mysqli.overview.php
mysqli(首选) pdo_mysql(建议) mysql(不建议)
PHP从5.4开始内置了MySQL驱动mysqlnd:
php-src/ext/mysqlnd/
php-src/ext/mysql/
php-src/ext/mysqli/
php-src/ext/pdo_mysql/
关系:mysql,mysqli,pdo_mysql这3套PHP操作MySQL的编程接口底层都依赖PHP内置的MySQL驱动mysqlnd. PHP5.3这样启用mysqlnd支持:
--with-mysql=mysqlnd
--with-mysqli=mysqlnd
--with-pdo-mysql=mysqlnd
PHP5.4后留空则默认启用mysqlnd:
--with-mysql
--with-mysqli
--with-pdo-mysql
PHP7开始不再支持--with-mysql.
--with-pdo-sqlite 默认启用,推荐采用pdo_sqlite来操作SQLite.
--with-sqlite3 默认启用,此扩展是试验性质的.
Windows二进制包ext目录下内置了下面几个扩展:
php_mysql.dll
php_mysqli.dll
php_pdo_mysql.dll
php_sqlite3.dll
php_pdo_sqlite.dll
Debian/Ubuntu软件包: php5-mysqlnd php5-sqlite PostgreSQL Driver for PHP:
--with-pgsql=DIR
--with-pdo-pgsql=DIR
DIR is the PostgreSQL base install directory or the path to pg_config.
Debian/Ubuntu软件包: php5-pgsql
apt-cache depends php5-pgsql 看到其依赖libpq5这个PostgreSQL的C客户端库.
开发包libpq-dev里带了/usr/bin/pg_config.
sudo apt-get install libpq-dev
--with-pgsql=/usr/bin/pg_config
--with-pdo-pgsql=/usr/bin/pg_config Oracle Driver for PHP:
--with-oci8=DIR
--with-pdo-oci=DIR 此扩展是试验性质的.
DIR defaults to $ORACLE_HOME.
或者安装Oracle Instant Client然后这样指定:
--with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib
--with-pdo-oci=shared,instantclient,/usr/lib/oracle,11.2
Oracle Instant Client下载地址(60MB):
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
php_oci8.dll
php_oci8_11g.dll
php_pdo_oci.dll
[root@cairui htdocs]# cat index.php
<?php
phpinfo();
?>
~
将配置文件放到安装路径下
[root@Centos php-5.4.]# cp php.ini-production /application/php/lib/php.ini
[root@Centos php-5.4.]# ls /application/php/lib/php.ini
/application/php/lib/php
[root@cairui htdocs]# cat /opt/apache/conf/httpd.conf | grep -v "#" ServerRoot "/opt/apache2.2.34" Listen LoadModule php7_module modules/libphp7.so <IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User php
Group php </IfModule>
</IfModule> ServerAdmin @qq.com ServerName 120.25.255.87: DocumentRoot "/opt/apache2.2.34/htdocs" <Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory> <Directory "/opt/apache2.2.34/htdocs">
Options -Indexes FollowSymLinks AllowOverride None Order allow,deny
Allow from all </Directory> <IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule> <FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch> ErrorLog "logs/error_log" LogLevel warn <IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule> CustomLog "logs/access_log" common </IfModule> <IfModule alias_module> ScriptAlias /cgi-bin/ "/opt/apache2.2.34/cgi-bin/" </IfModule> <IfModule cgid_module>
</IfModule> <Directory "/opt/apache2.2.34/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory> DefaultType text/plain <IfModule headers_module>
RequestHeader unset Proxy early
</IfModule> <IfModule mime_module>
TypesConfig conf/mime.types AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps </IfModule> Include conf/extra/httpd-mpm.conf Include conf/extra/httpd-default.conf <IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
连接mysql数据库测试
[root@cairui htdocs]# cat index.php
<?php
$servername = "127.0.0.1";
$username = "root";
$password = ""; // 创建连接
$conn = new mysqli($servername, $username, $password); // 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
echo "连接成功";
?>
php连接mysql报错No such file or directory php测试文件如下: <?php
$con = mysql_connect("localhost","root","zengjie2");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo "ok";
}
?> 访问后提示: Warning: mysql_connect(): No such file or directory in /usr/local/nginx/html/mysql.php on line
Could not connect: No such file or directory 解决方法: 登陆mysql 输入status,输出如下 Connection id:
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1. Source distribution
Protocol version:
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: min sec 记下UNIX socket路径 /var/lib/mysql/mysql.sock 查看/tmp/mysql.sock,不存在这个文件,那么建个Link cd /tmp
ln -s /var/lib/mysql/mysql.sock mysql.sock 重新访问php文件,成功连接。 以上是一种情况,另外一种情况: 存在/tmp/mysql.sock 但是不存在 /var/lib/mysql/mysql.sock cd /var/lib
mkdir mysql
cd mysql
ln -s /tmp/mysql.sock mysql.sock
PHP中使用localhost连接Mysql不成功的解决方法
发现问题 昨天在帮同事编译安装Linux环境时,遇到一个问题:
WEB服务器是apache,数据库是MySQL。 于是写了一个测试连接数据库的PHP页面:
复制代码 代码如下:
$mysql = mysql_connect('localhost','root','');
打开 http://localhost/test.php 测试 提示:Can't connect to local MySQL server through socket... 检查环境正常 以为是数据库没有启动,于是查看一下进程,MySQL在进程里,重启了一下MySQL. 使用mysql -u root -p 可以进入MySQL操作界面 直接使用/usr/local/php5/bin/php /web/test.php执行可以连上数据库
apache也重启了,一样无效 疑点:为何网页执行失败,命令执行却成功 这下就郁闷了,使用php命令直接执行就成功,通过网页执行就失败。难道是apache导致?网上搜索了大堆资料也没找到解决方案,重新编译安装apache问题依旧。 把localhost改成127.0.0.1成功 把localhost改成127.0.0.1后竟然连接成功了,开始陷入思考困局:localhost失败127.0.0.1却成功? ping localhost 地址是127.0.0.1没错 打开hosts加入
复制代码 代码如下: 127.0.0.1 qttc 使用qttc当主机连接也正常,唯独就不认localhost。
localhost连接方式不同导致 为了了解PHP连接数据库时,主机填写localhost与其它的区别阅读了大量资料,最后得知: 当主机填写为localhost时mysql会采用 unix domain socket连接
当主机填写为127.0.0.1时mysql会采用tcp方式连接
这是linux套接字网络的特性,win平台不会有这个问题 解决方法 在my.cnf的[mysql]区段里添加
复制代码 代码如下:
protocol=tcp 保存重启MySQL,问题解决!
配置文件:
[root@cairui lib]# egrep -v ";|^$" php.ini
[PHP]
engine = On
short_open_tag = Off
precision =
output_buffering =
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time =
max_input_time =
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len =
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads =
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout =
[CLI Server]
cli_server.color = On
[Date]
[filter]
[iconv]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size =
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port =
mail.add_x_header = On
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -
odbc.max_links = -
odbc.defaultlrl =
odbc.defaultbinmode =
[Interbase]
ibase.allow_persistent =
ibase.max_persistent = -
ibase.max_links = -
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -
mysqli.allow_persistent = On
mysqli.max_links = -
mysqli.cache_size =
mysqli.default_port =
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -
pgsql.max_links = -
pgsql.ignore_notice =
pgsql.log_notice =
[bcmath]
bcmath.scale =
[browscap]
[Session]
session.save_handler = files
session.use_strict_mode =
session.use_cookies =
session.use_only_cookies =
session.name = PHPSESSID
session.auto_start =
session.cookie_lifetime =
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability =
session.gc_divisor =
session.gc_maxlifetime =
session.referer_check =
session.cache_limiter = nocache
session.cache_expire =
session.use_trans_sid =
session.sid_length =
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character =
[Assertion]
zend.assertions = -
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=
soap.wsdl_cache_limit =
[sysvshm]
[ldap]
ldap.max_links = -
[dba]
[opcache]
[curl]
[openssl]
LAMP之PHP的更多相关文章
- Linux安装LAMP开发环境及配置文件管理
Linux主要分为两大系发行版,分别是RedHat和Debian,lamp环境的安装和配置也会有所不同,所以分别以CentOS 7.1和Ubuntu 14.04做为主机(L) Linux下安装软件,最 ...
- Web应用之LAMP源码环境部署
一.LAMP环境的介绍 1.LAMP环境的重要性 思索许久,最终还是决定写一篇详细的LAMP的源码编译安装的实验文档,一来是为了给自己一个交代,把技术进行系统的归纳,将技术以极致的形式呈现出来,做为一 ...
- 【笔记】LAMP 环境无脑安装配置 Centos 6.3
p.p1 { margin: 0.0px 0.0px 5.0px 0.0px; font: 12.0px Times; color: #ff2500 } p.p2 { margin: 0.0px 0. ...
- LAMP坏境和LNMP环境安装Nagios4.1.1和基本配置
----------------------------------------以下内容为笔者生产环境的监控,安装都是经过一步步测试的-------------------------------- ...
- 1-web应用之LAMP源码环境搭建
目录 一.LAMP环境的介绍 1.LAMP环境的重要性 2.LAMP组件介绍 二.Apache源码安装 1.下载Apache以及相关依赖包 2.安装Apache以及相关 ...
- CentOS7 配置LAMP
这两天要带新同事.没办法,只有现学现卖,又回到Linux的怀抱了.今晚想配置一下LAMP环境,但是之前用的6.6,今晚想闷声做大死,用一次7试试.网上找了很多教程,但是好像转载的都不负责任,有些到下一 ...
- Ubuntu 16.04 LAMP server 指南 - 配置 Apache2.4,PHP7,和MariaDB(而不是MySQL)
翻译自:https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/ 昨天在虚 ...
- LAMP(1) 在VirtualBox里安装Ubuntu Server
问题0.虚拟机中安装lamp环境 问题解决: 来自百度经验 问题1. 用putty远程登陆linux系统,显示network error connection refused 问题解决 问题2. my ...
- ubuntu10.04编译安装LAMP
ubuntu10.04编译安装LAMP以及简单wordpress的使用 : http://linuxme.blog.51cto.com/1850814/971631 一.源码安装LAMP 网上有一堆关 ...
- 转:CentOS/Debian/Ubuntu一键安装LAMP(Apache/MySQL/PHP)环境
CentOS/Debian/Ubuntu一键安装LAMP(Apache/MySQL/PHP) 今天遇到一个网友提到需要在Linux VPS服务器中安装LAMP(Apache/MySQL/PHP)网站环 ...
随机推荐
- 杂项:DCloud.io
ylbtech-杂项:DCloud.io 1.返回顶部 1. DCloud.io,数字天堂(北京)网络技术有限公司. 国内HTML5产业的领军企业,W3C会员,HTML5中国产业联盟发起单位Dclou ...
- maven学习6 Eclipse下Tomcat常用设置
Eclipse下Tomcat常用设置 1,Eclipse建立Tomcat服务 1.1 新建Server 首先这里是指,jee版的Eclipse.Eclipse是没有像MyEclipse那样集成Tomc ...
- java基础知识(15)----StringBuffer与StringBuilder
StringBuffer字符串缓冲区: 构造一个其中不带字符的字符串缓冲区,初始容量为 16 个字符.特点:1:可以对字符串内容进行修改.2:是一个容器.3:是可变长度的.4:缓冲区中可以存储任意类型 ...
- web基础 (二) html标签
一.html是什么? 超文本标记语言(Hypertext Markup Language,HTML)通过标签语言来标记要显示的网页中的各个部分.一套规则,浏览器认识的规则 浏览器按顺序渲染网页文件,然 ...
- Windows注册表各个作用
与注册表有关的术语1.注册表:是一个树状分层的数据库(如图).从物理上讲,它是System.dat和User.dat两个文件;从逻辑上讲,它是用户在注册表编辑器中看到的配置数据.2.HKEY :“根键 ...
- Python函数(七)-匿名函数
函数就是变量,定义一个函数就是把一个函数体赋值给一个函数名,函数和变量的回收机制也是一样的 匿名函数不需要指定函数名,只需要有函数体,然后把这个函数体赋给一个变量 Python中使用lambda来创建 ...
- 2010.1.1 CLR 无法从 COM 上下文
今天做一个程序,sql操作,但是记录数太多,而且sql语句有复杂,就报了这样的错误: CLR 无法从 COM 上下文 0x645e18 转换为 COM 上下文 0x645f88,这种状态已持续 60 ...
- intellij idea 在执行maven的操作 install等会出现中文乱码?其他程序打印正常?
之前一直碰到过这个问题,也没在意,因为那个中文对我来说用处不大,今天看着务必难受,一定把他给解决了,查了一下,找到了解决方法,如下: 首先打开你的设置. Setting->maven->r ...
- Codeforces 1114D Flood Fill (区间DP or 最长公共子序列)
题意:给你n个颜色块,颜色相同并且相邻的颜色块是互相连通的(连通块).你可以改变其中的某个颜色块的颜色,不过每次改变会把它所在的连通块的颜色也改变,问最少需要多少次操作,使得n个颜色块的颜色相同. 例 ...
- linq to sql 不能更新的问题
今天在项目中用linq更新一个表的时候,结果怎么都更新不了,最蛋疼的是什么异常也不报,发现db.table1.isReadOnly为True 知道问题所在,百度后得到解决办法: 原来是我的表没有增加主 ...