PHP - 技术教程文章

mac nginx 安装及PHP配置【代码】

安装nginx 1.安装brew命令ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"2.使用brew 安装nginxbrew install nginx3.修改配置nginx 文件 (文件应该在 /usr/local/etc/nginx/nginx.conf)server {listen 8080;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root /you/web/path; #配置web目录#root /usr/local/var/www;autoind...

在 ubuntu 上运行 php 脚本【代码】【图】

在 ubuntu 上运行 php 脚本 一、配置运行环境 1.要在 ubuntu 上运行 php 脚本,需要安装 Apache2 和 PHP 具体步骤,请参考:Ubuntu 搭建Web服务器(MySQL+PHP+Apache)详细教程 2.已经安装完,或者之前安装过,打开浏览器测试: 访问:http://localhost/ 如果出现:Apache2 Ubuntu Default Page 说明 Apache 服务器正在运行 截图:注:访问的页面是在/var/www/html目录里,这是安装 php 默认的路径 二、编写 php 脚本文件 1.新手此时...

CentOs7Nginx+php-fpm出现访问php文件404 not found【代码】

前提 1.nginx成功安装并跑起来了 2.php安装成功且php-fpm成功运行 3.netstat -antp | grep :80 and netstat -antp | grep :9000 ,80和9000端口处于监听状态 问题 [root@xxx ~] # curl -i http://localhost/test.php HTTP/1.1 404 Not Found Server: nginx/1.14.0 Date: Fri, 19 Oct 2018 06:38:47 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.6.38File n...

Linux下查找及修改PHP配置文件ini的路径[转载]【代码】【图】

##原本地址:http://www.findme.wang/blog/detail/id/278.html 一、查找PHP配置文件 说到查找,当然首先想到的是find命令。执行如下命令,即可查找到php.ini文件 find / -name php.ini可是,找到三个php.ini文件,具体哪个是当前正在运行的PHP使用的配置文件呢? PHP提供了两种方式,可供使用。方法一 这个是比较简单的方法,使用如下命令,可以清楚的看出当前的php使用的配置文件。php --ini可以使用php --help查看此命令方法二 打...

php启动后netstat看不到9000端口的问题

其实就是PHP配置文件改一个参数listen = 127.0.0.1:9000 在php-fpm.conf文件里找到这一行,如果listen后面不是127.0.0.1:9000则改成127.0.0.1:9000 但nginx配置也要和PHP配置保持一致 server里面也要指定fastcgi_pass 127.0.0.1:9000; /etc/php/7.1/fpm/php-fpm.conf 转载于:https://www.cnblogs.com/jonsea/p/5522018.html php-fpm配置文件详解

nginx与PHP配置

一、安装依赖包 yum -y install? libxml2? libxml2-devel? openssl? openssl-devel? curl? curl-devel libjpeg? libjpeg-devel? libpng? libpng-devel freetype? pcre pcre-devel? libxslt? libxslt-devel? bzip2?? bzip2-devel ? 二、安装php ?  1.下载php7.0wget??http://php.net/get/php-7.0.2.tar.gz/from/a/mirror解压安装 #?tar zxvf?php-7.0.2.tar.gz #?cd php-7.0.2 首先查看安装帮助 #?./configure?? --help #?./config...

菜鸟如何使用阿里云搭建服务器网站【阿里云、宝塔、thinkPHP、PHPstrom、Linux】②【图】

我们的流程:①在阿里云免费领取一个月的服务器,推荐使用支付宝账号登录、因为这样你就可以免除实名认证这个环节了。②配置我们服务器的系统,其实云服务器也就是一个虚拟机,想要运行还是需要一个操作系统的、这里推荐使用LInux【稳定可靠、故障率非常低、几乎不会被病毒和恶意代码感染和破坏、运行速度非常快】。③配置网站的运行环境,运行环境有几种LNMP、LAMP、WAMP……,这些字母L:Linux、W:win、A:Apache、N:NGINX、M:My...

Increase PHP script execution time with Nginx【代码】

If you have a large WordPress setup or a server with limited resources, then you will often see the “504 Gateway Time-out” error. You can follow the steps given below to increase the timeout value. PHP default is 30s. Changes in php.ini If you want to change max execution time limit for php scripts from 30 seconds (default) to 300 seconds. vim /etc/php5/fpm/php.ini Set… max_execution_time = 300...

ubuntu 先安装php再安装nginx后,php不解析【代码】【图】

本来服务器是nginx ,把他改成了apache, 安装apache,sudo apt-get updatesudo apt-get install apache2然后访问ip,不成功 vim /etc/apache2/apache2.conf 在最后添加这个#ServerNameServerName 127.0.0.1就出来Apache啥页面了,我忘了截图 创建phpinfo.php文件,访问,发现不解析 在执行这个命令,安装apache的php扩展sudo apt-get install libapache2-mod-php在访问就好了。

Linux编译安装Apache+PHP

Linux编译安装Apache+PHP 来自:自学it网,http://www.zixue.it/。 1】编译安装Apache+PHP 1.安装程序依赖库和开发环境 为了省事把所需要的库文件全都安装上,可以使用rpm包安装,也可以用yum命令安装, yum -y install gcc gcc-c++ autoconf automake make libjpeg libjpeg-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fs...

thinkphp nginx配置【代码】

#user nobody; worker_processes 1;#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024; }http {include mime.types;default_type application/octet-stream;log_format main $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$htt...

nginx限制上传大小和超时时间设置说明/php限制上传大小

现象说明:在服务器上部署了一套后台环境,使用的是nginx反向代理tomcat架构,在后台里上传一个70M的视频文件,上传到一半就失效了! 原因是nginx配置里限制了上传文件的大小 client_max_body_size:这个参数的设置限制了上传文件的大小,可以在http、server、location三个区域里配置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...

Windows(PHpstud)搭建Apache AND Nginx

一、搭建Apache( 每复制一个相当于新建一个虚拟主机)【 vhosts-conf】 <VirtualHost *:80> ? ?ServerAdmin ?webmaster@dummy-host2.example.com ? ?DocumentRoot "F:/www/console" ? ?ServerName ?console.com </VirtualHost> ? 二、搭建Nginx( 每复制一个相当于新建一个虚拟主机)【 vhosts-conf】 server { ? ? ? ?listen ? ? ? 80; ? ? ? ?server_name ?www.console.com; ? ?#填你:第2步dns解析,配置的虚拟域名(需要加www) ? ?...

php_ssh2操作linux

<?php /*** Created by PhpStorm.* User: Administrator* Date: 2018/9/15* Time: 14:11*/ header("content-type:text/html;charset=utf8"); ignore_user_abort(); ini_set(default_socket_timeout, -1); set_time_limit(0);$host = ***;//被控制的linux的ip $user = root;//用户名 $passwd = 123456;//密码 /////////////////// //链接远程服务器 /////////////////// $connection = @ssh2_connect($host, 2222); if (! $connecti...

linux php扩展安装:已删除安装源码的php环境

本文主要记录一次添加php扩展的操作过程 某php项目新增需求,用到curl模块,却发现未安装curl扩展,且php安装包已找不到。本次curl扩展安装,耗时近5个小时,特已此文记录 主要思路:1、安装与项目环境相同php版本 2、编译出符合版本的 .so文件 3、 复制.so文件到项目环境php扩展目录 4、修改配置文件php.ini,新增extension=curl.so 下面只讲.so文件生成操作: 1、进...

win10 php7.2 nginx 安装 imagick,适用于phpstudy【代码】

imagick 拓展的下载地址https://windows.php.net/downloads/pecl/releases/imagick/ 可惜的是这个地址最新版没有php7.2, 如果是7.1可以推荐 https://windows.php.net/downloads/pecl/snaps/imagick/ 这个snaps 版本支持php7.2, 此时最新为3.4.3当前服务器为NGINX, API320170718,NTS,VC15, 故PHP使用NTS版本,由此下载拓展:https://windows.php.net/downloads/pecl/snaps/imagick/3.4.3/php_imagick-3.4.3-7.2-nts-vc15-x86.zip...

centOS7 搭建LAMP服务器(apache+php+MariaDB)【图】

安装httpd 参考博客 https://blog.csdn.net/qq_36113598/article/details/77532647yum install httpd配置ServerNamevi /etc/httpd/conf/httpd.conf将#ServerName www.example.com:80修改为ServerName localhost:80 外部机器此时输入服务器的IP地址,应该看到apache的服务页面,端口不用输,apache默认就是使用80端口systemctl start httpd.service #开启httpd服务 systemctl enable httpd.service#配置httpd服务开机自启关闭防火墙...

nginx php-fpm conf文件编写

coco.conf ##upstream upstream php_coco_backend{ server 127.0.0.1:8019; }server { listen 80; server_name 139.224.68.68;location / { root htdocs_coco; index shop_index.php; }error_page 404 /shop/404.html;# redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; loca...

PHP-FPM监控shell

!/bin/bash #监控的网页地址url="http://dev2.jwsmed.com" #fastcgi启动/重启/停止脚本路径PROG=/data/fistsoft/php/sbin/php-fpm #fastcgi重启记录日志文件LOG=/data/services/logs/php_5525/restart.log #返回结果正常记录日志LOG2=/data/services/logs/php_5525/check.log #时间time=`date` #取得http状态码status=$(curl -H "dev2.jwsmed.com" -m 5 -L -s -w %{http_code} http://127.0.0.1 -o /dev/null) #如果不是200,就写入...

监控(2)-php-fpm进程监控 shell

#!/bin/bash #监控的网页地址url="http://dev2.jwsmed.com" #fastcgi启动/重启/停止脚本路径PROG=/data/fistsoft/php/sbin/php-fpm #fastcgi重启记录日志文件LOG=/data/services/logs/php_5525/restart.log #返回结果正常记录日志LOG2=/data/services/logs/php_5525/check.log #时间time=`date` #取得http状态码status=$(curl -H "dev2.jwsmed.com" -m 5 -L -s -w %{http_code} http://127.0.0.1 -o /dev/null) #如果不是200,就写...

使用PHPstudy在Windows服务器下部署PHP系统【图】

这篇文章主要介绍了关于使用PHPstudy在Windows服务器下部署PHP系统,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 PHP网站一般运行在Apache服务器上,IIS服务器上也可以运行,但是不推荐,windows服务器上没有集成Apache跟PHP的运行环境,但是借助第三方的软件就能很好的搞定,一般这样的软件有很多, 下面我分享一个借助PHPStudy部署PHP系统的教程,希望可以对大家有所帮助! 一:前期准备工作: 1. 下载PHPS...

linux下php源码安装步骤

一、下载php源码下载地址:http://cn.php.net/downloads.php二、安装1、将下载的二进制包移动到/usr/local目录,解压缩文件包tar zxvf php-7.1.4.tar.gz2、进入解压的php文件夹下/usr/local/php-7.1.4,安装依赖,编译安装yum install libxml2 libxml2-devel./configure --prefix=/usr/local/php --with-zlib --enable-zip --with-openssl --enable-fpm --enable-mbstring --with-libdir=lib64 --without-pear --disable-pharm...

PHP中你必须了解的4种Array函数

在日常的开发中foreach是我们用的最多的语法,但是有很多地方是不需要foreach就可以完成,而且比foreach更快。所以本篇文章给大家带来array_filter(),array_map(),array_walk(),array_reduce()这四个数组操作函数。只要学会了这四个函数我们在开发中就不用去写那么多循环操作了,而且效率比循环取值更快。array_filter()12345678910$arr = ['a',0,'b','c',1,2,3,4,5,6,7];//过滤掉所有的数字,只要字符串 减少自己循环的必要$new_...

php执行shell脚本的权限问题【图】

由于以前在ECS中每次都是以root用户身份登录和进行操作,所以基本都没有用到sudo,但是最近项目需要要进行这么个事:通过浏览器访问php网页,php网页里会调用执行linux下的一个脚本。本来这个事很简单的,但是我在实际操作的时候,发现每次通过浏览器访问时,脚本都没有被执行,而我在终端里面通过命令行执行php网页确又是没有任何问题的,当时就觉得很差异,后来仔细想了想,通过浏览器访问和直接在终端里执行其发起者不一样,想想...

shell脚本--php执行普通shell命令【图】

这里只演示一些普通的shell命令,一些需要root用户权限执行的命令,请参考:php以root权限执行shell命令php执行shell命令,可以使用下面几个函数:string system ( string $command [, int &$return_var ] ) string exec ( string $command [, array &$output [, int &$return_var ]] ) void passthru ( string $command [, int &$return_var ] )注意的是:这三个函数在默认的情况下,都是被禁止了的,如果要使用这几个函数,就要先...

PHP代码内执行Linux命令

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33679504/article/details/79039109 开发中遇到一种问题,需要在php函数中运行Linux系统代码,以下推荐2种方法,exec()函数和system()函数一、exec可以把执行的结果全部返回到output函数里(数组),status是执行的状态 0为成功 1为失败 二、systerm函数不需要提供output函数,他是直接把结果返回出来,同样return_var是执行的状态码 0为成功...

php执行shell脚本的权限问题【图】

由于以前在ECS中每次都是以root用户身份登录和进行操作,所以基本都没有用到sudo,但是最近项目需要要进行这么个事:通过浏览器访问php网页,php网页里会调用执行linux下的一个脚本。本来这个事很简单的,但是我在实际操作的时候,发现每次通过浏览器访问时,脚本都没有被执行,而我在终端里面通过命令行执行php网页确又是没有任何问题的,当时就觉得很差异,后来仔细想了想,通过浏览器访问和直接在终端里执行其发起者不一样,想想...

php利用sudo权限执行shell脚本【代码】

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhangsheng_1992/article/details/52805760 php作为一门服务器端脚本语言,也是可以调用系统命令的,这其中就包括了执行shell脚本编写test.sh脚本如下#! /bin/shmkdir /www/a很简单的一个shell脚本 创建一个文件夹php脚本如下system('/usr/bin/test.sh')在运行前 首先需要验证的 1.test.sh脚本是否具有可执行权限 2.apache nginx phttp等web服务...

Lnmp修改php.ini配置以及使exec()函数可用

转载自:http://www.chenruixuan.com/archives/341.html要在lnmp系统里面修改php.ini配置,首先要用find命令查找到php.ini所在位置:find / -name php.ini查找结果如下:usr/local/php/etc/php.ini然后用VI命令修改:vi /usr/local/php/etc/php.ini在php.ini中找到“disable_functions=passthru,system,exec,......”删除其中的“exec”,保存。修改后要重启才能生效,这里的重启并不是重启nginx-一定要注意。如果你的lnmp装的是ph...