当你发现chrome浏览器console里面报错: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://xbphp.nmfox.com//Index/article/7.html
其实这个报错是并不是指是代码错误,而是指路径错误.
这种报错其实就你URL从某个页面点击超链接进来才会出现..如果是直接访问就不会出现该错误,那到底是为什么呢?
你可以通过抓包来看一下HTTP状态,你就会发现:
你从某个页面点击进去的时候,这个HTTP请求的状态码500,但是实际页面并没影响而是可以正常访问
你直接从连接访问进去,这个HTTP请求的状态码200
这时候你就会哭笑不得,代码没错,服务器配置检查也没问题,但是为什么还有这个错误,其实一切源头在于linux系统,而win系统完全不会报错,为啥,因为URL路径出现了双斜杠导致….其实linux的路径检验特别严格..
分类目录归档:php
github的安装目录怎么找不到
windows系统
2016版的github桌面版安装完后发现怎么找不到安装目录
1 |
C:\Users\Administrator\AppData\Local\GitHub\PortableGit_c************9\mingw32\bin\git.exe |
打开这个目录 发现 git.exe 配置到phpstorm中
PHP写startswith和endswith
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php function starts_with($a,$b){ return strpos($a, $b) > 0?true: false; } var_dump(starts_with('I love she','L')); function end_with($a,$b,$lowerorup=1){ // 如果$lowerorup = 0则不用区分大小写 $begin= $lowerorup?strpos($a,$b):stripos($a,$b); if($begin){ echo '开始于第',$begin,'个字符<br />'; echo '结束于',$begin+strlen($b); } } echo '<br />'; end_with('I love she','Lov',0); |
centos7安装lnmp/nginx1.95 php7 mariadb10 2015最新教程
nginx1.95的安装
php7的安装
mariadb20的安装
如果都安装好后下面来整合
——————————————
systemctl 管理systemd启动
systemd启动nginx的安装
http://www.nmfox.com/2015/10/30/448.html
systemd启动php7的安装
http://www.nmfox.com/2015/11/04/468.html
systemd启动mariadb20 二进制的安装
http://www.nmfox.com/2015/11/10/479.html
linux-centos7中安装php7-0.0.0用最新管理systemctl控制启动关闭
linux之centos7中安装php7 后面有systemctl管理文件php-fpm.service
安装gcc gcc-c++ wget
1 |
yum -y install gcc gcc-c++ wget |
.安装一些库
1 |
yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel |
1 |
wget https://downloads.php.net/~ab/php-7.0.0RC5.tar.gz |
下载后解压进入目录
1 |
tar zxvf php-7.0.0RC5.tar.gz |
1 |
cd php-7.0.0RC5 |
# 配置参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-mcrypt=/usr/include \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysql-sock=/tmp/mysql.sock \ --enable-mysqlnd \ --with-gd \ --with-iconv \ --with-zlib \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --enable-ftp \ --enable-gd-native-ttf \ --with-openssl \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-zip \ --enable-soap \ --with-gettext \ --with-curl \ --with-jpeg-dir \ --with-freetype-dir |
编译
1 |
make |
安装
1 |
make install |
复制php.ini
1 |
cp php.ini-production /usr/local/php7/etc/php.ini |
复制php-fpm.conf
1 |
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf |
复制php-fpm下的conf
1 |
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf |
然后在php.ini中加入opcache
1 |
vim /usr/local/php7/etc/php.ini |
1 |
zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/opcache.so |
把php.ini中的这两expose_php版本号关掉
1 2 |
expose_php = Off cgi.fix_pathinfo=0 |
编辑 /php-fpm.conf
1 |
vim /usr/local/php7/etc/php-fpm.conf |
pid=/run/php-fpm.pid
然后把php-fpm加入systemd中
1 |
vim /usr/lib/systemd/system/php-fpm.service |
写入以下内容下面为systemctl管理php-fpm启动文件
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=simple PIDFile=/run/php-fpm.pid ExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target |
然后开启php-fpm用来管理php
1 |
systemctl start php-fpm.service |
加到开机自启动
1 |
systemctl enable php-fpm.service |
linux-centos7中安装php7-0.0.0教程
linux、centos7中安装php7
安装gcc gcc-c++ wget
1 |
yum -y install gcc gcc-c++ wget |
.安装一些库
1 |
yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel |
———————————————
下载PHP7下面为PHP7的下载地址
1 |
wget https://downloads.php.net/~ab/php-7.0.0RC5.tar.gz |
# 下载后解压进入目录
1 |
tar zxvf php-7.0.0RC5.tar.gz |
1 |
cd php-7.0.0RC5 |
# 配置参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-mcrypt=/usr/include \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysql-sock=/tmp/mysql.sock \ --enable-mysqlnd \ --with-gd \ --with-iconv \ --with-zlib \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --enable-ftp \ --enable-gd-native-ttf \ --with-openssl \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-zip \ --enable-soap \ --with-gettext \ --with-curl \ --with-jpeg-dir \ --with-freetype-dir |
编译
1 |
make |
安装
1 |
make install |
配置安装好的php
1 |
cp php.ini-production /usr/local/php7/etc/php.ini |
复php-fpm
1 |
cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm |
更改php7-fpm权限
1 |
chmod +x /etc/init.d/php7-fpm |
复php-fpm.conf
1 |
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf |
复php-fpm下的conf
1 |
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf |
然后在php.ini中加入opcache
1 |
vim /usr/local/php7/etc/php.ini |
1 |
zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/opcache.so |
# 启动
1 |
/etc/init.d/php7-fpm start |
# 查看PHP版本
/usr/local/php7/bin/php -v
为了安全最好是去掉头信息 X-Powered-By: PHP/7.*.*
则修改 php.ini 文件 设置 expose_php = Off
vim /usr/local/php7/etc/php.ini
找到 expose_php = On
改为 expose_php = Off
php7配置帮助文档
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
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 >= 0.9.8) --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 --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 4.x or 5.x support --with-db3=DIR DBA: Oracle Berkeley DB 3.x support --with-db2=DIR DBA: Oracle Berkeley DB 2.x support --with-db1=DIR DBA: Oracle Berkeley DB 1.x support/emulation --with-dbm=DIR DBA: DBM support --with-tcadb=DIR DBA: Tokyo Cabinet abstract DB 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.3 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-native-ttf GD: Enable TrueType string function --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-mcrypt=DIR Include mcrypt support --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 0x0300. Use the special value of 0 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.00 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,prefix,version for an Oracle Instant Client SDK. For example on Linux with 11.2 RPMs use: --with-pdo-oci=instantclient,/usr,11.2 With 10.2 RPMs use: --with-pdo-oci=instantclient,/usr,10.2.0.4 --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 3 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.0 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 --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.0 required) --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 --enable-zend-signals Use 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. |
php7的编译安装高性能的php喜欢的朋友们可以看下哦
linux中安装php7
# 安装mcrypt
yum install -y php-mcrypt libmcrypt libmcrypt-devel
编译PHP7
# 下载源代码
wget https://downloads.php.net/~ab/php-7.0.0RC5.tar.gz
tar zxvf php-7.0.0RC5.tar.gz
cd php-7.0.0RC5
# 配置参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-mcrypt=/usr/include \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysql-sock=/tmp/mysql.sock \ --enable-mysqlnd \ --with-gd \ --with-iconv \ --with-zlib \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --enable-ftp \ --enable-gd-native-ttf \ --with-openssl \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-zip \ --enable-soap \ --with-gettext \ --with-curl \ --with-jpeg-dir \ --with-freetype-dir |
编译
make
make install
vim /usr/local/php7/etc/php.ini
找到 expose_php = On
改为 expose_php = Off
php安全模式下被限制或屏蔽的函数
有时候开启安全模式 结果老在报错下面来看下被安全模式限制或屏蔽的函数
以下安全模式列表可能不完整或不正确。
安全模式限制函数
函数名
限制
dbmopen() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
dbase_open() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
filepro() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
filepro_rowcount() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
filepro_retrieve() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
ifx_* sql_safe_mode 限制, (!= safe mode)
ingres_* sql_safe_mode 限制, (!= safe mode)
mysql_* sql_safe_mode 限制, (!= safe mode)
pg_loimport() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
posix_mkfifo() 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
putenv() 遵循 ini 设置的 safe_mode_protected_env_vars 和 safe_mode_allowed_env_vars 选项。请参考 putenv() 函数的有关文档。
move_uploaded_file() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
chdir() 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
dl() 当 PHP 运行在 安全模式 时,不能使用此函数。
backtick operator 当 PHP 运行在 安全模式 时,不能使用此函数。
shell_exec()(在功能上和 backticks 函数相同) 当 PHP 运行在 安全模式 时,不能使用此函数。
exec() 只能在 safe_mode_exec_dir 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径中使用 ..。escapeshellcmd() 将被作用于此函数的参数上。
system() 只能在 safe_mode_exec_dir 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径中使用 ..。escapeshellcmd() 将被作用于此函数的参数上。
passthru() 只能在 safe_mode_exec_dir 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径中使用 ..。escapeshellcmd() 将被作用于此函数的参数上。
popen() 只能在 safe_mode_exec_dir 设置的目录下进行执行操作。基于某些原因,目前不能在可执行对象的路径中使用 ..。escapeshellcmd() 将被作用于此函数的参数上。
fopen() 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
mkdir() 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
rmdir() 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
rename() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
unlink() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
copy() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。 (on source and target)
chgrp() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
chown() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。
chmod() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 另外,不能设置 SUID、SGID 和 sticky bits
touch() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。
symlink() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。 (注意:仅测试 target)
link() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。 (注意:仅测试 target)
apache_request_headers() 在安全模式下,以“authorization”(区分大小写)开头的标头将不会被返回。
header() 在安全模式下,如果设置了 WWW-Authenticate,当前脚本的 uid 将被添加到该标头的 realm 部分。
PHP_AUTH 变量 在安全模式下,变量 PHP_AUTH_USER、PHP_AUTH_PW 和 PHP_AUTH_TYPE 在 $_SERVER 中不可用。但无论如何,您仍然可以使用 REMOTE_USER 来获取用户名称(USER)。(注意:仅 PHP 4.3.0 以后有效)
highlight_file(), show_source() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。 (注意,仅在 4.2.1 版本后有效)
parse_ini_file() 检查被操作的文件或目录是否与被执行的脚本有相同的 UID(所有者)。 检查被操作的目录是否与被执行的脚本有相同的 UID(所有者)。 (注意,仅在 4.2.1 版本后有效)
set_time_limit() 在安全模式下不起作用。
max_execution_time 在安全模式下不起作用。
mail() 在安全模式下,第五个参数被屏蔽。(注意,仅自 PHP 4.2.3 起受影响)
任何使用 php4/main/fopen_wrappers.c 的函数 ??
php工厂模式的介绍与使用
工厂模式:
由工厂类根据参数来决定创建出哪一种产品类的实例;
工厂类是指包含了一个专门用来创建其他对象的方法的类。所谓按需分配,传入参数进行选择,返回具体的类。工厂模式的最主要作用就是对象创建的封装、简化创建对象操作。
简单的说,就是调用工厂类的一个方法(传入参数)来得到需要的类;
代码实现:
示例1(最基本的工厂类):
<?php
class MyObject {
public function __construct(){}
public function test(){
return ‘测试’;
}
}
class MyFactory {
public static function factory(){
//返回对象的实例
return new MyObject();
}
}
//调用工厂类MyFactory中的静态方法,获取类MyObject的实例
$myobject=MyFactory::factory();
echo $myobject->test();
示例2:
<?php
//简单工厂模式
/1*
* 定义运算类
*/
abstract class Operation {
protected $_NumberA = 0;
protected $_NumberB = 0;
protected $_Result = 0;
public function __construct($A,$B){
$this->_NumberA = $A;
$this->_NumberB = $B;
}
public function setNumber($A,$B){
$this->_NumberA = $A;
$this->_NumberB = $B;
}
/1*
protected function clearResult(){
$this->_Result = 0;
}
*/
public function clearResult(){
$this->_Result = 0;
}
//抽象方法无方法体
abstract protected function getResult();
}
//继承一个抽象类的时候,子类必须实现抽象类中的所有抽象方法;
//另外,这些方法的可见性 必须和抽象类中一样(或者更为宽松)
class OperationAdd extends Operation {
public function getResult(){
$this->_Result=$this->_NumberA + $this->_NumberB;
return $this->_Result;
}
}
class OperationSub extends Operation {
public function getResult(){
$this->_Result=$this->_NumberA – $this->_NumberB;
return $this->_Result;
}
}
class OperationMul extends Operation {
public function getResult(){
$this->_Result=$this->_NumberA * $this->_NumberB;
return $this->_Result;
}
}
class OperationDiv extends Operation {
public function getResult(){
$this->_Result=$this->_NumberA / $this->_NumberB;
return $this->_Result;
}
}
class OperationFactory {
//创建保存实例的静态成员变量
private static $obj;
//创建访问实例的公共的静态方法
public static function CreateOperation($type,$A,$B){
switch($type){
case ‘+’:
self::$obj = new OperationAdd($A,$B);
break;
case ‘-‘:
self::$obj = new OperationSub($A,$B);
break;
case ‘*’:
self::$obj = new OperationMul($A,$B);
break;
case ‘/’:
self::$obj = new OperationDiv($A,$B);
break;
}
return self::$obj;
}
}
//$obj = OperationFactory::CreateOperation(‘+’);
//$obj->setNumber(4,4);
$obj = OperationFactory::CreateOperation(‘*’,5,6);
echo $obj->getResult();
/1*
echo ‘<br>’;
$obj->clearResult();
echo ‘<br>’;
echo $obj->_Result;
*/
示例3:
<?php
//抽象工厂
//青铜会员的打折商品
class BronzeRebateCommodity {
//描述
public $desc = ‘青铜会员的打折商品’;
}
//白银会员的打折商品
class SilverRebateCommodity {
public $desc = ‘白银会员的打折商品’;
}
//青铜会员的推荐商品
class BronzeCommendatoryCommodity {
public $desc = ‘青铜会员的推荐商品’;
}
//白银会员的推荐商品
class SilverCommendatoryCommodity {
public $desc = ‘白银会员的推荐商品’;
}
//各个工厂的接口
interface ConcreteFactory {
//生产对象的方法
public function create($what);
}
//青铜工厂
class BronzeFactory implements ConcreteFactory {
//生产对象的方法
public function create($what){
$productName = ‘Bronze’.$what.’Commodity’;
return new $productName;
}
}
//白银工厂
class SilverFactory implements ConcreteFactory {
//生产对象的方法
public function create($what){
$productName = ‘Silver’.$what.’Commodity’;
return new $productName;
}
}
//调度中心
class CenterFactory {
//获取工厂的方法
public function getFactory($what){
$factoryName = $what.’Factory’;
return new $factoryName;
}
//获取工厂的静态方法
public static function getFactory2($what){
$factoryName = $what.’Factory’;
return new $factoryName;
}
}
//实例化调度中心
$center = new CenterFactory();
//获得一个白银工厂
$factory = $center->getFactory(‘Silver’);
//让白银工厂制造一个推荐商品
$product = $factory->create(‘Commendatory’);
//得到白银会员的推荐商品
echo $product->desc.'<br>’;
//获得一个青铜工厂
$factory2 = CenterFactory::getFactory2(‘Bronze’);
//让青铜工厂制造一个打折商品
$product2 = $factory2->create(‘Rebate’);
//得到青铜会员的推荐商品
echo $product2->desc;
示例4:
<?php
//使用工厂类解析图像文件
interface IImage {
function getWidth();
function getHeight();
function getData();
}
class Image_PNG implements IImage {
protected $_width,$_height,$_data;
public function __construct($file){
$this->_file = $file;
$this->_parse();
}
private function _parse(){
//完成PNG格式的解析工作
//并填充$_width,$_height和$_data
$this->_data = getimagesize($this->_file);
list($this->_width,$this->_height)=$this->_data;
}
public function getWidth(){
return $this->_width;
}
public function getHeight(){
return $this->_height;
}
public function getData(){
return $this->_data;
}
}
class Image_JPEG implements IImage {
protected $_width,$_height,$_data;
public function __construct($file){
$this->_file = $file;
$this->_parse();
}
private function _parse(){
//完成JPEG格式的解析工作
//并填充$_width,$_height和$_data
//$this->_width = imagesx($this->_file);
//$this->_height = imagesy($this->_file);
$this->_data = getimagesize($this->_file);
list($this->_width,$this->_height)=$this->_data;
}
public function getWidth(){
return $this->_width;
}
public function getHeight(){
return $this->_height;
}
public function getData(){
return $this->_data;
}
}
//工厂类
class ImageFactory {
public static function factory($file){
$filename = pathinfo($file);
switch(strtolower($filename[‘extension’])){
case ‘jpg’:
$return = new Image_JPEG($file);
break;
case ‘png’:
$return = new Image_PNG($file);
break;
default:
echo ‘图片类型不正确’;
break;
}
if($return instanceof IImage){
return $return;
}else{
echo ‘出错了’;
exit();
}
}
}
$image = ImageFactory::factory(‘images/11.jpg’);
var_dump($image->getWidth());
echo ‘<br>’;
print_r($image->getheight());
echo ‘<br>’;
print_r($image->getData());