laravel openssl_cipher_iv_length()

laravel 错误

Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

phpinfo()

OpenSSL support disabled (install ext/openssl)

下载https://windows.php.net/downloads/php-sdk/deps/vc15/x64/openssl-1.1.1a-vc15-x64.zip

解压后bin目录能看到libcrypto-1_1-x64.dll和libssl-1_1-x64.dll,两个文件都拷到php目录和apache的bin下

开启extension=openssl

重启Apache就好了

apache2.4反向代理

debain

我们将使用:
mod_proxy ,主代理模块Apache模块用于重定向连接;它允许Apache充当底层应用程序服务器的网关。
mod_proxy_http ,它增加了对代理HTTP连接的支持。
mod_proxy_balancer和mod_lbmethod_byrequests ,它为多个后端服务器添加负载平衡功能。
要启用这四个模块,请连续执行以下命令。

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests

apache

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so


<VirtualHost *:8003>

ProxyPreserveHost On

ProxyPass / http://localhost:801/

ProxyPassReverse / http://localhost:801/

</VirtualHost>

apache gzip

#取消注释
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
#http.conf
<IfModule mod_deflate.c>
    SetOutputFilter DEFLATE    #必须的,就像一个开关一样,告诉apache对传输到浏览器的内容进行压缩
 
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary #设置不对后缀gif,jpg,jpeg,png的图片文件进行压缩
    SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary #同上,就是设置不对exe,tgz,gz。。。的文件进行压缩
    SetEnvIfNoCase Request_URI .(?:pdf|mov|avi|mp3|mp4|rm)$ no-gzip dont-vary
 
    AddOutputFilterByType DEFLATE text/* #设置对文件是文本的内容进行压缩,例如text/html  text/css  text/plain等
    AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript #这段代码你只需要了解application/javascript application/x-javascript这段就可以了,这段的意思是对javascript文件进行压缩
    AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp #这段是告诉apache对php类型的文件进行压缩
 
    BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.x 有一些问题,所以只压缩文件类型是text/html的
    BrowserMatch ^Mozilla/4.0[678] no-gzip # Netscape 4.06-4.08 有更多的问题,所以不开启压缩
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # IE浏览器会伪装成Netscape ,但是事实上它没有问题
</IfModule>

apache mac 配置+多站点

/etc/apache2/httpd.conf

去掉注释
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
User _www 改 User liuman

/private/etc/apache2/extra/httpd-vhosts.conf文件添加多网站

Listen 8001
<VirtualHost *:8001>
    DocumentRoot "/Users/liuman/phpinfo"
	<Directory "/Users/liuman/phpinfo">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8002
<VirtualHost *:8002>
    DocumentRoot "/Users/liuman/jlcloud2"
	<Directory "/Users/liuman/jlcloud2">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8003
<VirtualHost *:8003>
    DocumentRoot "/Users/liuman/web"
	<Directory "/Users/liuman/web">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8004
<VirtualHost *:8004>
    DocumentRoot "/Users/liuman/backend-jquery"
	<Directory "/Users/liuman/backend-jquery">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>

Listen 8005
<VirtualHost *:8005>
    DocumentRoot "/Users/liuman/laravel5"
	<Directory "/Users/liuman/laravel5">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
	</Directory>
</VirtualHost>
Listen 8007
<VirtualHost *:8007>
    DocumentRoot "/Users/liuman/wordpress"
 <Directory "/Users/liuman/wordpress">
    Options FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
 </Directory>
</VirtualHost>

mac配置

初始不设置磁盘加密
显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

不显示隐藏文件

defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

Mac基本快捷键

space:预览
command+w:关闭
command+q:退出
command+z:撤销
command+shift+z:重做
command+x:剪切
command+c:复制
command+v:粘贴
command+a:全选
command+r:刷新
command+s:保存
command+f:查找
command+space:切换输入法
command+tab:程序切换
command+~:同程序窗口切换
command++:放大
command+—:缩小
command+h:隐藏当前窗口
command+alt+f:隐藏除当前窗口外其他窗口
command+delete:删除
command+shift+delete:清空废纸篓
fn+command+delete:删除后面
command+方向键:光标跳到文本行的首位和文件的首位
command+F3:显示桌面
command+n:打开新窗口
command+m:最小化窗口
command+o:打开文件
command+ctrl+f:全屏
command+shift+3:截取全屏(+alt保存到剪切版)
command+shift+4:截取部分屏幕(按住space空格键选取窗口+alt保存到剪切版)
command+alt+esc:强制退出程序
按住command可以多选文件
开机alt选择启动驱动
control+shift+电源:关闭显示器
command+alt+电源:睡眠
command+control+电源:重启

触控板快捷方式-系统偏好设置-触控板有演示(滚动方向-自然不勾选)

环境变量设置:终端输入export PATH=/usr/local/php/bin:$PATH 或者在/etc/profile文件最后加入,立即执行环境变量文件source /etc/profile

安装brew

git config --global http.postBuffer 524288000
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

终端:终端iterm2下载 Finder-自定义工具栏-iterm2拖到工具栏上

Git:gitkarken下载

编辑器:macvim下载 macvim放到应用程序下 mvim放到/usr/bin/下

vim中文帮助:vimdoc下载 根目录sudo ./vimcdoc.sh -i

更多vim配置

ftp:filezilla客户端下载

数据库:mysql下载 安装后系统偏好设置有个Mysql图标,可以启动Mysql服务。

mysql配置:/usr/local/mysql/为maysql目录
设置mysql不需要密码,经常出错没有root密码,干脆不要密码,等创建完用户记得删掉,个人电脑就无所谓了,要密码还麻烦。

sudo cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
sudo vi /etc/my.cnf
#[mysqld]下添加
skip-grant-tables
#esc :wq!

apache:mac自带了apache,不需要安装,看了下版本是2.4.16,官方是2.4.20,还可以。apache服务的目录/etc/httpdctl或者/usr/sbin/httpd,模块目录/usr/libexec/apache2/,配置文件目录/etc/apache2/。启动服务:sudo apachectl start

安装php:php下载

#扩展openssl gd mbstring
./configure --prefix=/usr/local/php --with-apxs2=/usr/sbin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
make
make install
sudo cp php.ini-development /usr/local/php/lib/php.ini

配置apache

sudo vi /etc/apache2/httpd.conf
#查找字符串AddType,并增加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#查找字符串
DirectoryIndex
#并修改为
DirectoryIndex index.html index.php default.php
#将#LoadModule rewrite_module libexec/apache2/mod_rewrite.so的#删除
#AllowOverride None 改 AllowOverride All

php扩展安装

phpize

m4下载 autoconf下载
先编译安装m4然后编译安装autoconf

./configure
make
make install

或者使用brew

brew install homebrew/dupes/m4
brew install autoconf

扩展openssl

#进入到目录etc/openssl
export PATH=/usr/local/php/bin/:$PATH
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

php.ini加extension =openssl.so
重启apache
mongodb安装

#mongodb安装
brew install mongodb --with-openssl
#mongodb设置开机启动
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
#mongod服务启动
mongod --config /usr/local/etc/mongod.conf

node安装:

brew install node

redis安装

#redis安装
brew install redis
#redis设置开机启动
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
#redis服务启动
redis-server /usr/local/etc/redis.conf

supervisor安装

npm install supervisor -g

php不识别imagecreate()

没有gd,编译php扩展gd。
php.ini添加extension = gd.so

如果提示没有png.h则安装libpng:brew install libpng

php不识别imagettftext

安装freetype再重新编译gd:freetype下载

./configure --prefix=/usr/local/freetype
make
sudo make install
#编译freetype过程中以下harfbuss没有则安装
#  external zlib: yes (pkg-config)
#  bzip2:         yes (autoconf test)
#  libpng:        yes (pkg-config)
#  harfbuzz:      no  (pkg-config)
brew install harfbuzz

进入到php/ext/gd/

make clean
#重新编译GD之前一定要make clean就是因为忘记了这个找个半天错误。
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-freetype-dir=/usr/local/freetype
make
sudo make install

php不识别imagecreatefromjpeg

安装jpegsrc再重新编译gd:jpegsrc下载

./configure --prefix=/usr/local/jpeg
make
sudo make install

进入到php/ext/gd/

make clean
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype
make
sudo make install

linux学习二(apache)

源码编译安装

apache安装

官网下载apache

apache文件目录下编译

./configure --prefix=/usr/local/apache --enable-mods-shared=all

动态加载所有模块:–enable-mods-shared=all
-shared动态加载,去掉则静态加载,推荐–enable-mods-shared=all简单方便,只不过据说动态加载性能要比静态慢5%。

关于加载模块详情推荐一篇博文apache 静态编译和动态编译参考

提示:APR not found. Please read the documentation

apr和apr-util下载 pcre下载

apr编译安装

./configure --prefix=/usr/local/apr
make
make install

apr-util编译安装

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install

pcre编译安装

./configure --prefix=/usr/local/pcre
make
make install

编译apache

./configure --prefix=/usr/local/apache --enable-mods-shared=all

提示:APR-util not found. Please read the documentation

添加apr和apr-util以及pcre参数路径

./configure --prefix=/usr/local/apache --enable-mods-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre

apache 启动/停止/重启:apache目录下./httpd -k start/stop/restart
或者:sudo /usr/local/apache/bin/httpd -k start/stop/restart
非root用户启动需要给httpd权限:sudo chmod u+s httpd

php安装

xml2-config下载

python-dev安装

sudo apt-get update
sudo apt-get install python-dev

xml2-config编译安装

./configure --prefix=/usr/local/xml2-config
make
make install

php编译安装

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-libxml-dir=/usr/local/xml2-config
make
make install

配置apache支持php

sudo vi /usr/local/apache/conf/httpd.conf
#查找字符串AddType,并增加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#查找字符串
DirectoryIndex
#并修改为
DirectoryIndex index.html index.php default.php

配置php

#查看ini目录
./php --ini
sudo cp /home/liuman/下载/php-7.0.4/php.ini-development  /usr/local/php/lib/php.ini

php编译扩展

phpize

m4下载 autoconf下载

先编译安装m4然后编译安装autoconf

./configure
make
make install

开启openssl

sudo apt-get install libssl-dev
#进入到目录etc/openssl
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

php.ini加extension =openssl.so

yum安装

apache安装

yum install httpd -y

apache自启动

chkconfig httpd on

apache服务操作

service httpd start
service httpd stop
service httpd restart

安装php和mysql

yum install php
yum install mariadb

php版本如果太旧,先删除自带的php版本再安装,如果版本够用则直接安装php组件。

yum remove php*

安装第三方源和新版本php

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm 
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm  
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
yum install php56w

安装php组件

yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash

重启apache

apache配置php+多站点+多目录

1、

加入

LoadModule php5_module “d:/phpa/php5apache2_2.dll”

PHPIniDir “D:/phpa”

AddType application/x-httpd-php .php

AddType application/x-httpd-php .htm

2、

Options Indexes FollowSymLinks

改成

Options -Indexes FollowSymLinks

3、

DirectoryIndex index.html

改成

DirectoryIndex index.html index.php

4、

Listen 80

改成

Listen 8080

Listen 8800

5、

最后加入

<VirtualHost localhost:8080>

    DocumentRoot “D:/weba”

</VirtualHost>

<VirtualHost localhost:8800>

    DocumentRoot “D:/wza”

</VirtualHost>

<Directory “D:/weba”>

    Options -Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

<Directory “D:/wza”>

    Options -Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>