(个人探索)卸载windows 10自带应用方法

windows10自带了很多应用,说实在的,实在烂得让人失去吐槽的兴趣,卸载是最好的对策。网上有一些卸载方案,比如google搜索出的这两篇

感觉这里的方案有点简单粗暴,不够优雅。突然发现了一个更好的办法,利用windows任务管理器,只卸载让你感到恶心的那些“应用”。

方法如下:

  1. 如果你发现某个恶心的“应用”被打开了(比如双击打开某个视频文件后,打开了“电影与电视”),先不要关闭它。
  2. 打开windows任务管理器,进入“进程”选项卡,在“应用”一组里,找到上述应用,点右键 - 属性
  3. “属性”对话框的“常规”选项卡里的“位置”一项,是一个路径,形式如 C:\Program Files\WindowsApps\***** 最后一级目录(即前面星号代替部分)就是应用的包名,将包名复制到剪贴板
  4. 以管理员身份启动Powershell(可以在开始菜单里找到 Windows Powershell,点右键 - 以管理员身份运行),运行 Remove-AppxPackage 包名
  5. 完成。

这样就只卸载你不需要的那些应用。

 

某商vps上编译php时报错“undefined reference to `libiconv_open'”的处理

帮朋友的阿里云的服务器装wordpress。该服务器上面已经装了有好几个站点,web环境是wdlinux的所谓一键安装脚本,向来极其厌恶这种所谓的一键脚本,版本老化,目录不合理,乱。但为了兼容现有环境,还是决定在它上面继续。无语的是,这个web配置实在乱透了,nginx作前端,把动态请求反代到后方apache上,这样配置一个web站点,要同时设置两套web。而且还是使用php 5.2.17,这个老掉牙的版本!搞了半天,真心不想搞下去了。于是决定新安装php新版本,以php-fpm运行,简洁优雅地在nginx上跑。

之前自己服务器上路的是php 7.0.9,直接下载这个版本源码,使用之前自己的configure参数,但在make时出错了,错误消息第一行非常长,核心就是iconv有问题

undefined reference to `libiconv_open'

尝试安装iconv-devel等办法都使用了,都不行。

经过google,也有别的朋友遇到同样问题,make时加参数即可,如下:

 make ZEND_EXTRA_LIBS='-liconv'

堪称完美,在所有解决方案里最简便,向该博客作者表示感谢。


以下是信息备份,可以忽略。

下面是原始错误消息的部分

/bin/sh /www/wdlinux/php7/php-7.0.9/libtool --silent --preserve-dup-deps --mode=link cc -export-dynamic -I/usr/include -g -O2 -fvisibility=hidden      ext/date/php_date.lo ext/date/lib/astro.lo ext/date/lib/dow.lo ext/date/lib/parse_date.lo ext/date/lib/parse_tz.lo ext/date/lib/timelib.lo ext/date/lib/tm2unixtime.lo ext/date/lib/unixtime2tm.lo ext/date/lib/parse_iso_intervals.lo ext/date/lib/interval.lo ext/libxml/libxml.lo ext/pcre/pcrelib/pcre_chartables.lo ext/pcre/pcrelib/pcre_ucd.lo ext/pcre/pcrelib/pcre_compile.lo ext/pcre/pcrelib/pcre_config.lo ext/pcre/pcrelib/pcre_exec.lo ext/pcre/pcrelib/pcre_fullinfo.lo ext/pcre/pcrelib/pcre_get.lo ext/pcre/pcrelib/pcre_globals.lo ext/pcre/pcrelib/pcre_maketables.lo ext/pcre/pcrelib/pcre_newline.lo ext/pcre/pcrelib/pcre_ord2utf8.lo ext/pcre/pcrelib/pcre_refcount.lo ext/pcre/pcrelib/pcre_study.lo ext/pcre/pcrelib/pcre_tables.lo ext/pcre/pcrelib/pcre_valid_utf8.lo ext/pcre/pcrelib/pcre_version.lo ext/pcre/pcrelib/pcre_xclass.lo ext/pcre/pcrelib/pcre_jit_compile.lo ext/pcre/php_pcre.lo ext/sqlite3/sqlite3.lo ext/sqlite3/libsqlite/sqlite3.lo ext/zlib/zlib.lo ext/zlib/zlib_fopen_wrapper.lo ext/zlib/zlib_filter.lo ext/bcmath/bcmath.lo ext/bcmath/libbcmath/src/add.lo ext/bcmath/libbcmath/src/div.lo ext/bcmath/libbcmath/src/init.lo ext/bcmath/libbcmath/src/neg.lo ext/bcmath/libbcmath/src/outofmem.lo ext/bcmath/libbcmath/src/raisemod.lo ext/bcmath/libbcmath/src/rt.lo ext/bcmath/libbcmath/src/sub.lo ext/bcmath/libbcmath/src/compare.lo ext/bcmath/libbcmath/src/divmod.lo ext/bcmath/libbcmath/src/int2num.lo ext/bcmath/libbcmath/src/num2long.lo ext/bcmath/libbcmath/src/output.lo ext/bcmath/libbcmath/src/recmul.lo ext/bcmath/libbcmath/src/sqrt.lo ext/bcmath/libbcmath/src/zero.lo ext/bcmath/libbcmath/src/debug.lo ext/bcmath/libbcmath/src/doaddsub.lo ext/bcmath/libbcmath/src/nearzero.lo ext/bcmath/libbcmath/src/num2str.lo ext/bcmath/libbcmath/src/raise.lo ext/bcmath/libbcmath/src/rmzero.lo ext/bcmath/libbcmath/src/str2num.lo ext/calendar/calendar.lo ext/calendar/dow.lo ext/calendar/french.lo ext/calendar/gregor.lo ext/calendar/jewish.lo ext/calendar/julian.lo ext/calendar/easter.lo ext/calendar/cal_unix.lo ext/ctype/ctype.lo ext/curl/interface.lo ext/curl/multi.lo ext/curl/share.lo ext/curl/curl_file.lo ext/dom/php_dom.lo ext/dom/attr.lo ext/dom/document.lo ext/dom/domerrorhandler.lo ext/dom/domstringlist.lo ext/dom/domexception.lo ext/dom/namelist.lo ext/dom/processinginstruction.lo ext/dom/cdatasection.lo ext/dom/documentfragment.lo ext/dom/domimplementation.lo ext/dom/element.lo ext/dom/node.lo ext/dom/string_extend.lo ext/dom/characterdata.lo ext/dom/documenttype.lo ext/dom/domimplementationlist.lo ext/dom/entity.lo ext/dom/nodelist.lo ext/dom/text.lo ext/dom/comment.lo ext/dom/domconfiguration.lo ext/dom/domimplementationsource.lo ext/dom/entityreference.lo ext/dom/notation.lo ext/dom/xpath.lo ext/dom/dom_iterators.lo ext/dom/typeinfo.lo ext/dom/domerror.lo ext/dom/domlocator.lo ext/dom/namednodemap.lo ext/dom/userdatahandler.lo ext/exif/exif.lo ext/fileinfo/fileinfo.lo ext/fileinfo/libmagic/apprentice.lo ext/fileinfo/libmagic/apptype.lo ext/fileinfo/libmagic/ascmagic.lo ext/fileinfo/libmagic/cdf.lo ext/fileinfo/libmagic/cdf_time.lo ext/fileinfo/libmagic/compress.lo ext/fileinfo/libmagic/encoding.lo ext/fileinfo/libmagic/fsmagic.lo ext/fileinfo/libmagic/funcs.lo ext/fileinfo/libmagic/is_tar.lo ext/fileinfo/libmagic/magic.lo ext/fileinfo/libmagic/print.lo ext/fileinfo/libmagic/readcdf.lo ext/fileinfo/libmagic/softmagic.lo ext/filter/filter.lo ext/filter/sanitizing_filters.lo ext/filter/logical_filters.lo ext/filter/callback_filter.lo ext/ftp/php_ftp.lo ext/ftp/ftp.lo ext/gd/gd.lo ext/gd/libgd/gd.lo ext/gd/libgd/gd_gd.lo ext/gd/libgd/gd_gd2.lo ext/gd/libgd/gd_io.lo ext/gd/libgd/gd_io_dp.lo ext/gd/libgd/gd_io_file.lo ext/gd/libgd/gd_ss.lo ext/gd/libgd/gd_io_ss.lo ext/gd/libgd/gd_webp.lo ext/gd/libgd/gd_png.lo ext/gd/libgd/gd_jpeg.lo ext/gd/libgd/gdxpm.lo ext/gd/libgd/gdfontt.lo ext/gd/libgd/gdfonts.lo ext/gd/libgd/gdfontmb.lo ext/gd/libgd/gdfontl.lo ext/gd/libgd/gdfontg.lo ext/gd/libgd/gdtables.lo ext/gd/libgd/gdft.lo ext/gd/libgd/gdcache.lo ext/gd/libgd/gdkanji.lo ext/gd/libgd/wbmp.lo ext/gd/libgd/gd_wbmp.lo ext/gd/libgd/gdhelpers.lo ext/gd/libgd/gd_topal.lo ext/gd/libgd/gd_gif_in.lo ext/gd/libgd/xbm.lo ext/gd/libgd/gd_gif_out.lo ext/gd/libgd/gd_security.lo ext/gd/libgd/gd_filter.lo ext/gd/libgd/gd_pixelate.lo ext/gd/libgd/gd_arc.lo ext/gd/libgd/gd_rotate.lo ext/gd/libgd/gd_color.lo ext/gd/libgd/gd_transform.lo ext/gd/libgd/gd_crop.lo ext/gd/libgd/gd_interpolation.lo ext/gd/libgd/gd_matrix.lo ext/hash/hash.lo ext/hash/hash_md.lo ext/hash/hash_sha.lo ext/hash/hash_ripemd.lo ext/hash/hash_haval.lo ext/hash/hash_tiger.lo ext/hash/hash_gost.lo ext/hash/hash_snefru.lo ext/hash/hash_whirlpool.lo ext/hash/hash_adler32.lo ext/hash/hash_crc32.lo ext/hash/hash_fnv.lo ext/hash/hash_joaat.lo ext/iconv/iconv.lo ext/json/json.lo ext/json/json_encoder.lo ext/json/json_parser.lo ext/json/json_scanner.lo ext/mbstring/oniguruma/regcomp.lo ext/mbstring/oniguruma/regerror.lo ext/mbstring/oniguruma/regexec.lo ext/mbstring/oniguruma/reggnu.lo ext/mbstring/oniguruma/regparse.lo ext/mbstring/oniguruma/regenc.lo ext/mbstring/oniguruma/regext.lo ext/mbstring/oniguruma/regsyntax.lo ext/mbstring/oniguruma/regtrav.lo ext/mbstring/oniguruma/regversion.lo ext/mbstring/oniguruma/st.lo ext/mbstring/oniguruma/enc/unicode.lo ext/mbstring/oniguruma/enc/ascii.lo ext/mbstring/oniguruma/enc/utf8.lo ext/mbstring/oniguruma/enc/euc_jp.lo ext/mbstring/oniguruma/enc/euc_tw.lo ext/mbstring/oniguruma/enc/euc_kr.lo ext/mbstring/oniguruma/enc/sjis.lo ext/mbstring/oniguruma/enc/iso8859_1.lo ext/mbstring/oniguruma/enc/iso8859_2.lo ext/mbstring/oniguruma/enc/iso8859_3.lo ext/mbstring/oniguruma/enc/iso8859_4.lo ext/mbstring/oniguruma/enc/iso8859_5.lo ext/mbstring/oniguruma/enc/iso8859_6.lo ext/mbstring/oniguruma/enc/iso8859_7.lo ext/mbstring/oniguruma/enc/iso8859_8.lo ext/mbstring/oniguruma/enc/iso8859_9.lo ext/mbstring/oniguruma/enc/iso8859_10.lo ext/mbstring/oniguruma/enc/iso8859_11.lo ext/mbstring/oniguruma/enc/iso8859_13.lo ext/mbstring/oniguruma/enc/iso8859_14.lo ext/mbstring/oniguruma/enc/iso8859_15.lo ext/mbstring/oniguruma/enc/iso8859_16.lo ext/mbstring/oniguruma/enc/koi8.lo ext/mbstring/oniguruma/enc/koi8_r.lo ext/mbstring/oniguruma/enc/big5.lo ext/mbstring/oniguruma/enc/utf16_be.lo ext/mbstring/oniguruma/enc/utf16_le.lo ext/mbstring/oniguruma/enc/utf32_be.lo ext/mbstring/oniguruma/enc/utf32_le.lo ext/mbstring/libmbfl/filters/html_entities.lo ext/mbstring/libmbfl/filters/mbfilter_7bit.lo ext/mbstring/libmbfl/filters/mbfilter_ascii.lo ext/mbstring/libmbfl/filters/mbfilter_base64.lo ext/mbstring/libmbfl/filters/mbfilter_big5.lo ext/mbstring/libmbfl/filters/mbfilter_byte2.lo ext/mbstring/libmbfl/filters/mbfilter_byte4.lo ext/mbstring/libmbfl/filters/mbfilter_cp1251.lo ext/mbstring/libmbfl/filters/mbfilter_cp1252.lo ext/mbstring/libmbfl/filters/mbfilter_cp1254.lo ext/mbstring/libmbfl/filters/mbfilter_cp5022x.lo ext/mbstring/libmbfl/filters/mbfilter_cp51932.lo ext/mbstring/libmbfl/filters/mbfilter_cp850.lo ext/mbstring/libmbfl/filters/mbfilter_cp866.lo ext/mbstring/libmbfl/filters/mbfilter_cp932.lo ext/mbstring/libmbfl/filters/mbfilter_cp936.lo ext/mbstring/libmbfl/filters/mbfilter_gb18030.lo ext/mbstring/libmbfl/filters/mbfilter_euc_cn.lo ext/mbstring/libmbfl/filters/mbfilter_euc_jp.lo ext/mbstring/libmbfl/filters/mbfilter_euc_jp_2004.lo ext/mbstring/libmbfl/filters/mbfilter_euc_jp_win.lo ext/mbstring/libmbfl/filters/mbfilter_euc_kr.lo ext/mbstring/libmbfl/filters/mbfilter_euc_tw.lo ext/mbstring/libmbfl/filters/mbfilter_htmlent.lo ext/mbstring/libmbfl/filters/mbfilter_hz.lo ext/mbstring/libmbfl/filters/mbfilter_iso2022_jp_ms.lo ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_2004.lo ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.lo ext/mbstring/libmbfl/filters/mbfilter_iso2022_kr.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_1.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_10.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_13.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_14.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_15.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_16.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_2.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_3.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_4.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_5.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_6.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_7.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_8.lo ext/mbstring/libmbfl/filters/mbfilter_iso8859_9.lo ext/mbstring/libmbfl/filters/mbfilter_jis.lo ext/mbstring/libmbfl/filters/mbfilter_koi8r.lo ext/mbstring/libmbfl/filters/mbfilter_armscii8.lo ext/mbstring/libmbfl/filters/mbfilter_qprint.lo ext/mbstring/libmbfl/filters/mbfilter_sjis.lo ext/mbstring/libmbfl/filters/mbfilter_sjis_open.lo ext/mbstring/libmbfl/filters/mbfilter_sjis_mobile.lo ext/mbstring/libmbfl/filters/mbfilter_sjis_mac.lo ext/mbstring/libmbfl/filters/mbfilter_sjis_2004.lo ext/mbstring/libmbfl/filters/mbfilter_tl_jisx0201_jisx0208.lo ext/mbstring/libmbfl/filters/mbfilter_ucs2.lo ext/mbstring/libmbfl/filters/mbfilter_ucs4.lo ext/mbstring/libmbfl/filters/mbfilter_uhc.lo ext/mbstring/libmbfl/filters/mbfilter_utf16.lo ext/mbstring/libmbfl/filters/mbfilter_utf32.lo ext/mbstring/libmbfl/filters/mbfilter_utf7.lo ext/mbstring/libmbfl/filters/mbfilter_utf7imap.lo ext/mbstring/libmbfl/filters/mbfilter_utf8.lo ext/mbstring/libmbfl/filters/mbfilter_utf8_mobile.lo ext/mbstring/libmbfl/filters/mbfilter_uuencode.lo ext/mbstring/libmbfl/filters/mbfilter_koi8u.lo ext/mbstring/libmbfl/mbfl/mbfilter.lo ext/mbstring/libmbfl/mbfl/mbfilter_8bit.lo ext/mbstring/libmbfl/mbfl/mbfilter_pass.lo ext/mbstring/libmbfl/mbfl/mbfilter_wchar.lo ext/mbstring/libmbfl/mbfl/mbfl_convert.lo ext/mbstring/libmbfl/mbfl/mbfl_encoding.lo ext/mbstring/libmbfl/mbfl/mbfl_filter_output.lo ext/mbstring/libmbfl/mbfl/mbfl_ident.lo ext/mbstring/libmbfl/mbfl/mbfl_language.lo ext/mbstring/libmbfl/mbfl/mbfl_memory_device.lo ext/mbstring/libmbfl/mbfl/mbfl_string.lo ext/mbstring/libmbfl/mbfl/mbfl_allocators.lo ext/mbstring/libmbfl/nls/nls_de.lo ext/mbstring/libmbfl/nls/nls_en.lo ext/mbstring/libmbfl/nls/nls_ja.lo ext/mbstring/libmbfl/nls/nls_kr.lo ext/mbstring/libmbfl/nls/nls_neutral.lo ext/mbstring/libmbfl/nls/nls_ru.lo ext/mbstring/libmbfl/nls/nls_uni.lo ext/mbstring/libmbfl/nls/nls_zh.lo ext/mbstring/libmbfl/nls/nls_hy.lo ext/mbstring/libmbfl/nls/nls_tr.lo ext/mbstring/libmbfl/nls/nls_ua.lo ext/mbstring/mbstring.lo ext/mbstring/php_unicode.lo ext/mbstring/mb_gpc.lo ext/mbstring/php_mbregex.lo ext/mcrypt/mcrypt.lo ext/mcrypt/mcrypt_filter.lo ext/mysqli/mysqli.lo ext/mysqli/mysqli_api.lo ext/mysqli/mysqli_prop.lo ext/mysqli/mysqli_nonapi.lo ext/mysqli/mysqli_fe.lo ext/mysqli/mysqli_report.lo ext/mysqli/mysqli_driver.lo ext/mysqli/mysqli_warning.lo ext/mysqli/mysqli_exception.lo ext/mysqli/mysqli_result_iterator.lo ext/pdo/pdo.lo ext/pdo/pdo_dbh.lo ext/pdo/pdo_stmt.lo ext/pdo/pdo_sql_parser.lo ext/pdo/pdo_sqlstate.lo ext/pdo_mysql/pdo_mysql.lo ext/pdo_mysql/mysql_driver.lo ext/pdo_mysql/mysql_statement.lo ext/pdo_sqlite/pdo_sqlite.lo ext/pdo_sqlite/sqlite_driver.lo ext/pdo_sqlite/sqlite_statement.lo ext/phar/util.lo ext/phar/tar.lo ext/phar/zip.lo ext/phar/stream.lo ext/phar/func_interceptors.lo ext/phar/dirstream.lo ext/phar/phar.lo ext/phar/phar_object.lo ext/phar/phar_path_check.lo ext/posix/posix.lo ext/reflection/php_reflection.lo ext/session/mod_user_class.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/shmop/shmop.lo ext/simplexml/simplexml.lo ext/simplexml/sxe.lo ext/spl/php_spl.lo ext/spl/spl_functions.lo ext/spl/spl_engine.lo ext/spl/spl_iterators.lo ext/spl/spl_array.lo ext/spl/spl_directory.lo ext/spl/spl_exceptions.lo ext/spl/spl_observer.lo ext/spl/spl_dllist.lo ext/spl/spl_heap.lo ext/spl/spl_fixedarray.lo ext/standard/crypt_freesec.lo ext/standard/crypt_blowfish.lo ext/standard/crypt_sha512.lo ext/standard/crypt_sha256.lo ext/standard/php_crypt_r.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/sha1.lo ext/standard/user_filters.lo ext/standard/uuencode.lo ext/standard/filters.lo ext/standard/proc_open.lo ext/standard/streamsfuncs.lo ext/standard/http.lo ext/standard/password.lo ext/standard/random.lo ext/tokenizer/tokenizer.lo ext/tokenizer/tokenizer_data.lo ext/xml/xml.lo ext/xml/compat.lo ext/xmlreader/php_xmlreader.lo ext/xmlwriter/php_xmlwriter.lo ext/zip/php_zip.lo ext/zip/zip_stream.lo ext/zip/lib/zip_add.lo ext/zip/lib/zip_add_dir.lo ext/zip/lib/zip_add_entry.lo ext/zip/lib/zip_buffer.lo ext/zip/lib/zip_file_set_mtime.lo ext/zip/lib/zip_io_util.lo ext/zip/lib/zip_source_begin_write.lo ext/zip/lib/zip_source_call.lo ext/zip/lib/zip_source_commit_write.lo ext/zip/lib/zip_source_is_deleted.lo ext/zip/lib/zip_source_remove.lo ext/zip/lib/zip_source_rollback_write.lo ext/zip/lib/zip_source_seek.lo ext/zip/lib/zip_source_seek_write.lo ext/zip/lib/zip_source_supports.lo ext/zip/lib/zip_source_tell.lo ext/zip/lib/zip_source_tell_write.lo ext/zip/lib/zip_source_write.lo ext/zip/lib/zip_close.lo ext/zip/lib/zip_delete.lo ext/zip/lib/zip_dir_add.lo ext/zip/lib/zip_dirent.lo ext/zip/lib/zip_discard.lo ext/zip/lib/zip_entry.lo ext/zip/lib/zip_err_str.lo ext/zip/lib/zip_error.lo ext/zip/lib/zip_error_clear.lo ext/zip/lib/zip_error_get.lo ext/zip/lib/zip_error_get_sys_type.lo ext/zip/lib/zip_error_strerror.lo ext/zip/lib/zip_error_to_str.lo ext/zip/lib/zip_extra_field.lo ext/zip/lib/zip_extra_field_api.lo ext/zip/lib/zip_fclose.lo ext/zip/lib/zip_fdopen.lo ext/zip/lib/zip_file_add.lo ext/zip/lib/zip_file_error_clear.lo ext/zip/lib/zip_file_error_get.lo ext/zip/lib/zip_file_get_comment.lo ext/zip/lib/zip_file_get_offset.lo ext/zip/lib/zip_file_rename.lo ext/zip/lib/zip_file_replace.lo ext/zip/lib/zip_file_set_comment.lo ext/zip/lib/zip_file_strerror.lo ext/zip/lib/zip_filerange_crc.lo ext/zip/lib/zip_fopen.lo ext/zip/lib/zip_file_get_external_attributes.lo ext/zip/lib/zip_file_set_external_attributes.lo ext/zip/lib/zip_fopen_encrypted.lo ext/zip/lib/zip_fopen_index.lo ext/zip/lib/zip_fopen_index_encrypted.lo ext/zip/lib/zip_fread.lo ext/zip/lib/zip_get_archive_comment.lo ext/zip/lib/zip_get_archive_flag.lo ext/zip/lib/zip_get_compression_implementation.lo ext/zip/lib/zip_get_encryption_implementation.lo ext/zip/lib/zip_get_file_comment.lo ext/zip/lib/zip_get_name.lo ext/zip/lib/zip_get_num_entries.lo ext/zip/lib/zip_get_num_files.lo ext/zip/lib/zip_memdup.lo ext/zip/lib/zip_name_locate.lo ext/zip/lib/zip_new.lo ext/zip/lib/zip_open.lo ext/zip/lib/zip_rename.lo ext/zip/lib/zip_replace.lo ext/zip/lib/zip_hash.lo ext/zip/lib/zip_set_archive_comment.lo ext/zip/lib/zip_set_archive_flag.lo ext/zip/lib/zip_set_default_password.lo ext/zip/lib/zip_set_file_comment.lo ext/zip/lib/zip_set_file_compression.lo ext/zip/lib/zip_set_name.lo ext/zip/lib/zip_source_buffer.lo ext/zip/lib/zip_source_close.lo ext/zip/lib/zip_source_crc.lo ext/zip/lib/zip_source_deflate.lo ext/zip/lib/zip_source_error.lo ext/zip/lib/zip_source_file.lo ext/zip/lib/zip_source_filep.lo ext/zip/lib/zip_source_free.lo ext/zip/lib/zip_source_function.lo ext/zip/lib/zip_source_layered.lo ext/zip/lib/zip_source_open.lo ext/zip/lib/zip_source_pkware.lo ext/zip/lib/zip_source_read.lo ext/zip/lib/zip_source_stat.lo ext/zip/lib/zip_source_window.lo ext/zip/lib/zip_source_zip.lo ext/zip/lib/zip_source_zip_new.lo ext/zip/lib/zip_stat.lo ext/zip/lib/zip_stat_index.lo ext/zip/lib/zip_stat_init.lo ext/zip/lib/zip_strerror.lo ext/zip/lib/zip_string.lo ext/zip/lib/zip_unchange.lo ext/zip/lib/zip_unchange_all.lo ext/zip/lib/zip_unchange_archive.lo ext/zip/lib/zip_unchange_data.lo ext/zip/lib/zip_utf-8.lo ext/zip/lib/mkstemp.lo ext/mysqlnd/mysqlnd.lo ext/mysqlnd/mysqlnd_alloc.lo ext/mysqlnd/mysqlnd_charset.lo ext/mysqlnd/mysqlnd_wireprotocol.lo ext/mysqlnd/mysqlnd_loaddata.lo ext/mysqlnd/mysqlnd_reverse_api.lo ext/mysqlnd/mysqlnd_net.lo ext/mysqlnd/mysqlnd_statistics.lo ext/mysqlnd/mysqlnd_driver.lo ext/mysqlnd/mysqlnd_ext_plugin.lo ext/mysqlnd/mysqlnd_auth.lo ext/mysqlnd/mysqlnd_result.lo ext/mysqlnd/mysqlnd_result_meta.lo ext/mysqlnd/mysqlnd_debug.lo ext/mysqlnd/mysqlnd_block_alloc.lo ext/mysqlnd/mysqlnd_plugin.lo ext/mysqlnd/php_mysqlnd.lo ext/mysqlnd/mysqlnd_ps.lo ext/mysqlnd/mysqlnd_ps_codec.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/fopen_wrappers.lo main/alloca.lo main/php_scandir.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/network.lo main/php_open_temporary_file.lo main/output.lo main/getopt.lo main/streams/streams.lo main/streams/cast.lo main/streams/memory.lo main/streams/filter.lo main/streams/plain_wrapper.lo main/streams/userspace.lo main/streams/transports.lo main/streams/xp_socket.lo main/streams/mmap.lo main/streams/glob_wrapper.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dtrace.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_vm_opcodes.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_sort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_gc.lo Zend/zend_closures.lo Zend/zend_float.lo Zend/zend_string.lo Zend/zend_signal.lo Zend/zend_generators.lo Zend/zend_virtual_cwd.lo Zend/zend_ast.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_inheritance.lo Zend/zend_smart_str.lo Zend/zend_execute.lo main/internal_functions_cli.lo sapi/cli/php_cli.lo sapi/cli/php_http_parser.lo sapi/cli/php_cli_server.lo sapi/cli/ps_title.lo sapi/cli/php_cli_process_title.lo -lcrypt -lz -lcrypt -lrt -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lcurl -lxml2 -lz -lm -lfreetype -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt  -o sapi/cli/php
ext/gd/libgd/.libs/gdkanji.o: In function `do_convert':
/www/wdlinux/php7/php-7.0.9/ext/gd/libgd/gdkanji.c:349: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/gd/libgd/gdkanji.c:364: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/gd/libgd/gdkanji.c:380: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:2557: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:755: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:779: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:813: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:474: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:508: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1505: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1998: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:2001: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1616: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1619: undefined reference to `libiconv_open'
ext/iconv/.libs/iconv.o: In function `_php_iconv_substr':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:876: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:900: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:955: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:959: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:908: undefined reference to `libiconv_open'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1194: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1208: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1326: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1278: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1310: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1470: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1379: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1411: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1467: undefined reference to `libiconv_close'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1454: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `php_iconv_string':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:578: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:590: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:608: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:618: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1003: undefined reference to `libiconv_open'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1031: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:1145: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:2708: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:2707: undefined reference to `libiconv'
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:2629: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
/www/wdlinux/php7/php-7.0.9/ext/iconv/iconv.c:2583: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1
[root@iZ237wk0cjiZ php-7.0.9]#

 

顺利安装后,消息如下

[root@iZ237wk0cjiZ php-7.0.9]# make install
Installing shared extensions:     /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/
Installing PHP CLI binary:        /usr/local/php7/bin/
Installing PHP CLI man page:      /usr/local/php7/php/man/man1/
Installing PHP FPM binary:        /usr/local/php7/sbin/
Installing PHP FPM config:        /usr/local/php7/etc/
Installing PHP FPM man page:      /usr/local/php7/php/man/man8/
Installing PHP FPM status page:   /usr/local/php7/php/php/fpm/
Installing phpdbg binary:         /usr/local/php7/bin/
Installing phpdbg man page:       /usr/local/php7/php/man/man1/
Installing PHP CGI binary:        /usr/local/php7/bin/
Installing PHP CGI man page:      /usr/local/php7/php/man/man1/
Installing build environment:     /usr/local/php7/lib/php/build/
Installing header files:           /usr/local/php7/include/php/
Installing helper programs:       /usr/local/php7/bin/
program: phpize
program: php-config
Installing man pages:             /usr/local/php7/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment:      /usr/local/php7/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.0
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.3.0
[PEAR] PEAR           - installed: 1.10.1
Wrote PEAR system config file at: /usr/local/php7/etc/pear.conf
You may want to add: /usr/local/php7/lib/php to your php.ini include_path
/www/wdlinux/php7/php-7.0.9/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin
ln -s -f phar.phar /usr/local/php7/bin/phar
Installing PDO headers:           /usr/local/php7/include/php/ext/pdo/
[root@iZ237wk0cjiZ php-7.0.9]#

windows下安装zip压缩版的mysql服务器端v5.7.16

环境:windows 10某个版本(写本文的最新版本)

目的:安装个mysql服务端,从官方下载的zip压缩版5.7.16,而不是msi版本。

操作过程折腾了,以前安装过多次,不过好像不是真正意义上的从zip安装,而是使用之前通过msi安装过的版本,后面只是注册成系统服务一项。

本次折腾的的操作,主要从官方是下载.zip版本压缩包,选择的是x64版,解压缩到合适的目录里,本文以 C:\Program Files\mysql\  为例。

step 0. 准备配置文件:复制my-default.ini得到my.ini ,修改其中的basedir, datadir两个参数,示例如下

basedir = C:\Program Files\mysql
datadir = D:\data\mysql-data

step 1. 安装为windows服务:管理员身份启动cmd,进入mysql/bin/目录,执行如下安装命令:

mysqld --install MySQL --defaults-file="C:\Program Files\mysql\my.ini"

注意:--install 参数必须在前,否则mysqld会认为你要运行mysqld进程,然后启动失败)

setp 2. 初始化数据目录:创建 D:\data\ ,注意不需要创建mysql-data子目录;运行 mysqld --initialize

step 3. 查root用户初始密码:查windows日志-应用程序日志,里面应该有类似如下一条

A temporary password is generated for root@localhost: 5cuiMezaNd>QFor more information....

其中5cuiMezaNd>Q即是默认密码,到命令行里修改一下吧,如下一行,将root密码改为000111, 会有交互提示输入旧密码的。

mysqladmin.exe -uroot -p password "000111"

step 4. 启动windows服务:net start MySQL. 完工。

Addition. 如需要卸载服务,到mysql/bin/目录里执行 mysqld.exe --remove 即可。需要的话删除mysql数据文件目录。

Let’s Encrypt HTTPS证书申请部署与自动续期/免费ssl,nginx,centos

一年半以前曾经买过一个廉价的https/ssl证书,部署在本博客blog.path8.net上,时间大概在 2015-5-17,然而并没有正式启用,以至于过期也都没有注意。前几天想于把这个事情搞起来。以前的经验是,廉价ssl证书都是只对一个域名有效,但竟然发现Let's Encrypt的免费证书,还是多域名的。近一年的新文章里,有不少人对之大加赞扬;于是准备试试。同时也发现了腾讯云也有免费ssl证书,单域名的,免费一年,试用了一下,签发速度比较快,部署到本站上。不过还是决定使用Let's Encrypt。下面是简单记录。

vps环境CentOS 6.x, niginx

花了半天时间研究Let's Encrypt的相关文章(基本都是中文博客),另外尤其仔细读了其官方网站,开始实际操作,发现真的很简单。

ssh登录到服务器上操作,并且操作需要需要root权限。

1. 自动部署脚本需要epel源,如果之前没有安装先安装之 yum install epel-release

2. 在线获取签署脚本(按自己的习惯保存到合适目录)。签署脚本官方称之为客户端,有多个版本,这里使用的官方推荐的 certbot

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto

3. 运行签署脚本。脚本里注意两人参数 -w, -d,分别是一个web目录及该目录对应的域名;多组目录就多次指定。这里只是获得证书文件,不做自动部署。(猜测是因为该脚本不支持nginx的自动部署,毕竟nginx不在centos官方源里,不同服务器上安装方式 不一样)。如下所示。

./certbot-auto certonly --webroot \
-w /var/www/html/blog.path8.net/html -d blog.path8.net \
-w /var/www/html/www.path8.net/html -d www.path8.net -d path8.net -d fengyqf.com

4. 接下来会自动通过yum安装几个依赖包,同意即可。

5. 然后是几步交互式对话:邮箱地址、同意条款、照着操作即可。因为Let's Encrypt是自动签署,速度非常快,大概整个过程只花费了两三分钟(包括交互过程里等待用户操作的时间)。

letsencrypt_req_email

交互询问邮箱地址

按其他网友的文章所说,使用国内dns服务很容易引发域名解析失败;此次使用dnspod却是一次成功的。成功后消息如文后。

在目录里 /etc/letsencrypt/live/{your.domain.ext}/ 得到四个文件:cert.pem chain.pem fullchain.pem privkey.pem  。简单理解,前两个是给Apache用的,后两个是给Nginx用的。(注意 privkey.pem 这个文件是私钥,内容千万要保密!)

事实上这四个文件是到/etc/letsencrypt/archive/{your.domain.ext}/ 下文件的符号链接。从结构上看,更新证书时,会自动更新符号链接目标。

按脚本执行的输出,运行日志记录在 Saving debug log to /var/log/letsencrypt/letsencrypt.log

下面是签署脚本成功执行后的消息。

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/blog.path8.net/fullchain.pem. Your cert will
   expire on 2017-01-14. To obtain a new or tweaked version of this
   certificate in the future, simply run certbot-auto again. To
   non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - If you lose your account credentials, you can recover through
   e-mails sent to f***@gmail.com.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

6. 部署证书文件到nginx上。主要是ssl_* 的行,指定为证书目录。

    server {
        listen 80;
        listen 443;
        ssl on;
        ssl_certificate  /etc/nginx/ssl/blog.path8.net_cert.crt;
        ssl_certificate_key  /etc/nginx/ssl/blog.path8.net.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location / {
                index  index.html index.htm index.php;
                # from nginx.org rewrite rule
                # This is cool because no php is touched for static
                try_files $uri $uri/ /index.php;
        }
    ......
    }

7. 重新加载nginx配置,或者重启 nginx -s reload  ,然后测试https访问。记得iptables放行443端口。

8. 如果需要,将80端口301重定向到443.

9. 配置定时任务以自动更新证书。重新签署证书及加载证书,将脚本加入到定时任务中,/path/to/certbot-auto renew --quiet  . 重新加载nginx配置以应用新证书的脚本如  nginx -s reload

纯文本数据处理的实用脚本(bash,awk)

计算最大字段长度

典型用途:csv文件导入到数据库时,用于规划字段长度

$ cat file.csv |awk -F "," -v fields_count=10 'BEGIN{for(i=1;i<=fields_count;i++){xcount[i]=0}} {for(i=1;i<=fields_count;i++){if(xcount[i]<length($i) ){xcount[i]=length($i)}}} END{for(i=1;i<=fields_count;i++){print i,xcount[i]}}'

合并将当前目录下所有.csv文件,只保留惟一的首行

典型用途:一系列csv文件,列完全一致,首行是列名;需要将它们合并后做后期处理,通常我们只要保留一个列名行即可。

要求:1) 所有csv文件结尾是空行,否则接合处坏掉;标准的csv文件结尾会有个空行的。 2) 不能有字段内换行符;即字符内换行符需要转义,而不是excel生成的csv文件那样操蛋的转义规则(不转义换行符;用两个并列双引号转义双引号)

head -1 `ls *.csv |grep -v "all.csv" |head -1` >all.csv; total=0;for file in `ls -d *.csv|grep -v 'all.csv'`; do echo -n $file '    '; n=`wc -l $file |awk '{print $1}' `;n=$((n-1));total=$((total+n));echo -n $n 'lines...    ';tail -$n $file >>all.csv;echo ' done'; done; echo 'total lines:    ' $total

实现方法简述:找一个csv文件,将第首行写到all.csv中,然后遍历所有csv文件(除all.csv外),计算行数,将行数减1,将结尾的这么多行追加到all.csv中

MySQL(csv,text)导入mssql方法参考

分两步处理,第一步是将csv导入到mysql。没有使用mssql自带客户端的导入功能,因为这个功能太坑,尝试N多种方法仍然是报错,因此选择先转换成mysql做中间步骤。

csv/text导入MySQL

一批很大的csv数据(其实并非csv,而是制表符分隔字段),要导入到mssql数据库里。

首先在cygwin下使用awk对数据做预处理,只筛选出字符数正确的行。并且在首行加入列名,以便导入工具自动做列对应。

然后计算各字段最大长度;因为字段数太多(63个),所以计算一下,用于构造create table语句。对于最大长度在255以下的字段使用varchar(n)型,255以上使用longtext类型。

#参考下面语句
$ awk -F "\t" 'NF==63 {print $0}' all.csv >all_63f.txt
$ head -1 origin_text_file.txt >h.txt
$ dos2unix h.txt       #注意最好不要带BOM,否则自行另存一下,避免麻烦
$ cat h.txt all_63f.txt >a63_with_head.txt

#最大计算字符长度,本身并不复杂,只是写在一行里,阅读不太方便
$ awk -F "\t" 'BEGIN{for(i=1;i<=63;i++){xcount[i]=0}} {for(i=1;i<=63;i++){if(xcount[i]<length($i) ){xcount[i]=length($i)}}} END{for(i=1;i<=63;i++){print i,xcount[i]}}' all_63f.txt

接下来使用Navicat for MySQL将导入csv。navcate可以试用,功能足够用;如果使用频繁,建议购买授权。

MySQL导入mssql

以下win2008 x64下的mssql 2012为例。

安装mysql的.net驱动 http://dev.mysql.com/downloads/connector/

create table,建表,与mysql结构一致。

使用mssql自带导入功能导入数据,导入数据源选择 .Net Framework Data Provider for MySQL,填写必要的主机名、登录名、口令,如下

mysql_import_into_mssql_via_nf

不能选择源数据表,必须写select 语句,如: select f1,f2,f3... from `db`.`table` where 1

后面应该没有什么难度了。

phpmyadmin3.x版在windows下的新版本php里日期显示乱码的补丁方案

现象:

一直使用的phpmyadmin3.5版本(RELEASE-DATE-3.5.0,一个做了配置优化的版本 phpMyAdmin_3.5_path8.net),这个版本比较简洁,更新的pma有些臃肿。然而,在windows下使用php5.5, 及php7.0,都发现日期显示成乱码

phpmyadmin_35_date_string_bad

方案:

文件 libraries/common.lib.php , 行1648行

        $format = __('%B %d, %Y at %I:%M %p');

改成

        $format = '%Y-%m-%d %H:%M:%S';

即可,日期格式显示格式示例 2016-01-27 11:49:07

phpmyadmin_35_date_string_fixed

原因:

PMA_localisedDate函数使用了strftime()函数,该strftime函数第一个参数为日期格式,phpmyadmin源程序使用了带中文的格式字符串;而在windows下的php版本,在做格式化时会转成乱码。经确认linux下没有这个问题,pma是正常的。

 

mac osx下apache下的坑: you don't have permission to access / on this server

max osx下的apache实在别扭,配置文件被拆得支离破碎(虽然有点拆分还是有道理的),这倒可以慢慢适应。无语的是竟然报403错:

apache you don't have permission to access / on this server. mac

Apache/2.4.16 (Unix) PHP/5.5.29

google后,得知,要在Directory指令里,增加一条 Require all granted,如下示:

<Directory "/Users/jnovack/Sites/">
  Options Indexes MultiViews
  AllowOverride All
  # OSX 10.10 / Apache 2.4
  Require all granted
</Directory>

参考http://stackoverflow.com/questions/25250566/apache-localhost-403-error-with-yosemite

被mac osx坑死了。。。。

一些wordpress插件兼容php7.x后的一些修改

不知算不算手贱,把VPS服务器上的php升级到7.0, 虽然7.x与之前的兼容性是很高的,但移除了一大堆过时用法,而某些老应用仍然在使用。对个人wordpress站点里出现的错误,修正记录如下。全部是插件,wordpress官方程序,是没有问题的。

mysql_escape_string() 函数改为addslashes()

wp-thread-comment插件 wp-content/plugins/wordpress-thread-comment/wp-thread-comment.php  有多处

mysql_* 系列函数在php7里全部移除了,所以建议在所有文件里搜索一下 mysql_query, mysql_escape_, mysql_real_eacape 等函数,如:  grep -r mysql_query /path/to/your/site

split()函数改为explode()

auto-save-image插件 wp-content/plugins/auto-save-image/auto-save-image.php  122行

语法兼容

Configure SMTP插件  wp-content/plugins/configure-smtp/configure-smtp.php  171行,为函数定义添加默认值

public function options_page_description( $localized_heading_text = '' ) {

php下数据库持久连接,及apache模块下“数据库并发连接数超限”的潜在风险

php下的多个数据库引擎都提供持久连接的特性,实现了“连接池”的作用,让数据库连接“复用”,目的是减少php引擎连接数据库的消耗。这有类似fastCGI协议的设计初衷:让后端进程复用,节省启动关闭CGI进程的性能开锁。

数据库持久连接的实现方式

这需要从php的运行模式说起。典型的php运行模式是传统CGI、fastCGI、web模块三种。

其中CGI模式不支持持久连接,因为php每次处理请求,都是由一个独立的进程(操作系统的进程)处理,请求处理完毕,进程就销毁了,相应的数据连接之类的资源当然也已不存在,所以CGI本身是不支持持久连接的。

fastCGI模式下,php进程由进程管理器所管理。(apache下实现实例,参看这里)。不管哪种fastCGI方案,其背后都是一系列长期运行的进程(操作系统下的进程),进程本身可以保持资源,因此,php脚本引擎可以提供应用的接口,允许程序员将数据库连接保持下来,供下次php处理请求,可以直接复用这个连接。

web模块下,类似fastCGI模式。linux下apache默认prefork下,每个httpd进程在同一时刻只响应一个http请求,每个httpd进程可以看做一个fastCGI进程。

多数据库账号的持久连接

假设一web服务器下的所有应用,都是持久连接,并且使用了惟一的数据库连接账号。假设共开了10个fastCGI进程在运行,每个进程都保持了一个持久连接,如果当前处理请求需要连接数据库,直接使用该持久连接即可,不需要新连接数据库。事实上,运行一段时间后,就是这样状态。

假设该web服务器下的应用,共有10个数据库连接账号。每fastCGI进程,从启动开始,每处理一个新的数据库账号相关的请求,就要多保持一个持久连接。因为不同数据库账号的连接,肯定不能复用的。这样,在运行一段时间后,每个fastCGI进程都要维持10个持久连接,分别对应每个数据库账号。

以apache模块模式下运行的httpd进程,可以等同于一个fastCGI进程,上面讨论同样适用。

进程数及连接数讨论,及apache下的潜在风险!

如果web服务器下的的php应用,分别使用了多个数据库账号,而且全部连到同一台数据库服务器。这样,

该数据库的并发连接数 = fastCGI进程数 * 数据库账号数
如果php在apache模块下运行,使用httpd进程数代替fastCGI进程数

通常,fastCGI进程数量是比较有限的,对于一台web服务器,它接受的请求里,大多数请求都是静态的(想像一下,一个页面里,通常只有主html文档是动态,而里面的js,css,图片等等元素都是静态;这里不考虑“静态内容全部移到CDN上”的极端情况)。fastCGI进程数数,通常会远比http并发数小。

在apache模块运行的php下,所有请求都是由httpd进程处理的,每个httpd进程都有可能维护每个数据库用户相关的持久连接,如果数据库用户量较大,这个对mysql服务器并发的连接数影响非常大。通常mysql服务器都会设置一个最大并发数据,超过限制后,就不再受新连接!

php下持久连接的更多信息,参考官方文档 http://php.net/manual/zh/features.persistent-connections.php

 

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 Next