PHP - 技术教程文章

php – 从windows上的proc_open()捕获stderr输出【代码】

我正在调用proc_open(),我无法捕获写入stderr的进程的输出:$curFolder = getcwd(); $procDescriptor = array( 2 => array( "pipe", "w" ) ); $cmd = "MyApp.exe -f optimization.csv"; $process = proc_open( $cmd, $procDescriptor, $pipes, $curFolder );if( is_resource( $process ) == true ) {$procStatus = proc_get_status( $process );while( $procStatus['running'] === true ){if( !feof( $pipes[2] ) ){$logLine = fg...

redhat更改yum源及安装PHP环境【图】

redhat更新yum源 删除同RHEL一同安装的yum源 rpm -qa|grep yum  #查看本地yum yum list | wc -l #看个数 yum install pip #看现象 rpm -qa|grep yum|xargs rpm -e --nodeps  #卸载本地yum,不检查依赖性,卸载yum程序 重装yum资料来源: https://blog.51cto.com/xiaocao13140/2131856 给了3个python-urlgrabber-3.9.1-11.el6.noarch.rpmyum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpmyum-3.2.29-81.el6.centos.noarch.rpm...

是否可以让PHP脚本使用Linux用户信息对用户进行身份验证?【代码】

我目前正在尝试为我的公司扩展我的PHP驱动的Intranet站点.它本质上是一堆杂项报告和实用程序,我把它们放在一起并链接到内部网络服务器上.每当人们不断想要完成相同的任务时,我会尽可能地编写脚本并将其放在内部网页面上,这样人们就可以在没有我帮助的情况下完成任务. 到目前为止,这种方法运作良好,但有一些实用程序需要仅限于管理人员等.现在,我知道我可以创建一个完整的注册系统来对用户进行身份验证,就像在公共网站上做的那样,但...

使用C#PHP中的命名管道进行进程间通信

使用C#中的命名管道进行进程间通信很简单,但我不确定如何在php中执行此操作,或者甚至可能.所以我有这些问题: >在php中可以命名管道吗?>是否可以拥有一个C#命名管道客户端,连接到php命名管道服务器?>我怎么编码呢?

我在我的ubuntu上安装了phpmyadmin,但它没有用【代码】

我在我的ubuntu 10.4上安装phpmyadmin但它无法登录 这是/etc/phpmyadmin/config.inc.php文件的内容 如果输入密码#2002则无法登录MySQL服务器 如果我们不输入密码配置禁止没有密码的登录(请参阅AllowNoPassword) 你能帮助我吗/*** Debian local configuration file** This file overrides the settings made by phpMyAdmin interactive setup* utility.** For example configuration see /usr/share/doc/phpmyadmin/examples/config...

Linux下搭建PHP开发环境(LAMP)

LAMP:Linux+Apache+Mysql/MariaDB+Perl/PHP/Python Linux下PHP开发环境搭建(Apache2.4+PHP7.1+MySQL5.7) - 鸿鹄凌云之志的个人空间 - OSCHINA https://my.oschina.net/hhly/blog/1547227 Linux下PHP开发环境搭建(Apache2.4+PHP7.1+MySQL8.0) - 单炒饭 - CSDN博客 https://blog.csdn.net/weixin_42075590/article/details/80741211

Installing Cacti 0.8.8h and php weathermap 0.98 on CentOS 7

Installing Cacti 0.8.8h and php weathermap 0.98 on CentOS 7 Overview Cacti is an open-source, web-based network monitoring and graphing tool used to get a graph data such as CPU usage, memory usage, network bandwidth utilization, and more. It can graph the network traffic by polling a router or switch using SNMP protocol. In this article will show how to install Cacti on CentOS 7. To use PHP weath...

How to Install PHP 5.6 on CentOS 7

By default the CentOS 7 official software package repositories have PHP 5.4, which has reached the end of life and no longer actively maintained by the developers. To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system. Therefore it is strongly recommended for you to upgrade or install a latest supported stable versio...

Ubuntu安装php7.2

1、使用ppa增加源 apt-get install python-software-properties apt-get install software-properties-common add-apt-repository ppa:ondrej/php2、更新 apt-get update3、查看源中PHP7.2版本 apt list | grep php 列表中已经包含你想要的PHP版本了4、安装PHP7.2 apt-get -y install php7.2

是否使用PHP / CGI的shell命令不好的做法?

shell命令是否被视为合法的编程接口?具体来说,从PHP页面或CGI文件在Linux应用程序服务器上执行bash shell命令有什么问题吗?这是否会引入效率或安全问题? 谢谢解决方法:有时可以,但…… 有时它是解决问题的最佳方式. 但可能的问题是: 安全 如果你没有做taint checking,请注意code injection. 性能 运行shell命令将涉及forking PHP解释器并执行复杂且相对较慢的system calls.这对于负载较轻的服务器是可以的,但对于繁忙的站点不起...

memory-management – memory_get_peak_usage与实际php进程的内存使用量之间的差异【代码】

为什么php memory_get_peak_usage的结果与在Linux中使用’top’或’ps’命令时显示为已分配给进程的内存大小有很大差异? 我在php.ini中设置了2 Mb的memory_limit我的单字符串php脚本echo memory_get_peak_usage(true);说它使用的是786432字节(768 Kb) 如果我尝试询问系统当前的php进程echo shell_exec('ps -p '.getmypid().' -Fl');它给了我F S UID PID PPID C PRI NI ADDR SZ WCHAN RSS PSR STIME TTY TIM...

phpmyadmin之getshell总结【代码】【图】

title: phpmyadmin中getshell的几种姿势1,利用全局变量general_log去getshell show variables like ‘%general%’;然后将general_log打开,执行命令set global general_log=on; 因为phpstudy默认的根目录是/phpstudy/www/,所以接下来只需要修改日志文件的位置到网站的根目录下。 set global general_log_file=‘C:/phpstudy/www/v01cano.php’;验证文件是否存在访问该文件后发现,日志文件正常解析了,说明修改路径成功。会以文本...

是PHP的file_get_contents内存和数据有效吗?【代码】

我正在制作推送通知服务器,从外部(第三方)html页面收集特定数据,如果我知道我需要的信息是在第一个例如5000个字符,如果我声明MAX_LENGTH,PHP实际上会使用更少的内存吗?或者整个页面是否完全加载到内存中?此外,是否已下载整个html页面,或者一旦达到限制就断开连接? (反过来节省数据传输成本)$html = file_get_contents ("http://.....", false, null, -1, 5000);谢谢.解决方法:是的,它确实节省了内存和带宽……我还进行了速度测试...

php – 在x86_64 GNU / Linux上升级PEAR【代码】

当我运行sudo pear upgrade pear时,它以下列错误结束:ERROR: unable to unpack /tmp/tmpsozA4Q/Structures_Graph-1.0.4.tgz有没有人遇到过这样的事情,你对如何解决这个问题有任何建议吗?它让我彻夜难眠.解决方法:通常这个错误是由于一个非常过时的梨版本,甚至不能再与梨服务器通信并下载HTML页面而不是真正的存档. 要解决此问题,您需要手动更新梨.wget http://pear.php.net/go-pear.phar php go-pear.phar并按照“系统安装”说明...

tp5+linux+apache php7.1.30环境下,上传图片报错:mkdir():permission denied【代码】【图】

做了个自己的博客,后台上传图片的时候报错如图:首先反应是权限问题,runtime和uploads文件夹已经给了777权限了,超出菜鸟的解决范围,果断百度,但是百度了一堆,全部是关于runtime的,直到我看到了跟我一样问题的大兄弟:手动艾特他们https://www.cnblogs.com/ctsch/p/7859565.html,https://ask.fastadmin.net/question/1180.html 我捋一捋记忆(刚解决的就记不住了...TAT):说的是用户组跟用户的权限不到位,在apache的配置文...

这是php中的快速进程strpos()/ stripos()或preg_match()【代码】

我只是想知道在php中哪一个是快速的strpos()/ stripos()或preg_match()函数.解决方法:我发现this blog已经针对你的问题运行了一些睾丸,结果是: > strpos()比preg_match()快3-16倍> stripos()比strpos()慢2-30倍> stripos()比preg_match()快20-100%无壳修饰语“// i”>在preg_match()中使用正则表达式并不比使用a更快长串>在preg_match()中使用utf8修饰符“// u”会使它慢2倍 使用的代码是:<?phpfunction loop(){$str_50 = str_r...

php nginx window系统 gettext方式实现UTF-8国际化多语言(i18n)【代码】【图】

开始应用: 步骤一:搭建环境(服务器已经完成,环境已经搭建好了) 1、首先查看你的php扩展目录下是否有php_gettext.dll这个文件,如果没有,这就需要你下载一个或是从其他地方拷贝一个,然后放到php扩展目录。2、打开php.ini,查找”;extension=php_gettext.dll“ ,然后去除注释,重启nginx。 若一切顺利,就可以在 phpinfo() 中看到 gettext 字样,至此服务器环境配置完毕。 步骤二:假如我们要翻译test.php页面里的hello word.这...

thinkphp在 nginx 的conf文件配置

server {   listen 80;   server_name www.osd-aisa.com;#charset koi8-r;   #access_log logs/host.access.log main;root /www/web/aoshade;   index index.html index.php;error_page 500 502 503 504 /50x.html;   location = /50x.html {     root html;   }location ~ \.php$ {     fastcgi_pass 127.0.0.1:9000;     fastcgi_index...

PHP静态变量内存使用情况【代码】

我一直想知道静态变量在内存使用方面是如何工作的,甚至应该真的考虑过? 我知道静态变量只会耗尽一个内存区域,无论该类本身有多少个实例.所以在这个意义上,使用静态变量进行明智的内存消耗应该是明智的,对吧?但我从来没有偶然发现任何人谈论静态变量的内存使用情况(只有你可以与不同的实例共享数据). 例如:class Something () {static $DB = null;__construct ($DB) {$this->DB = $DB;} }如果我要创建这个类的10个实例,那么与非静...

email – 从Windows服务器发送PHP邮件【代码】

我的页面上有一个表单.当用户点击发送按钮时 – 它应该发送一封电子邮件,其中包含他在表单中输入的详细信息.直到最近,表单都托管在Linux服务器上,我没有遇到任何问题 – 邮件已发送和接收.最近我不得不转移到共享Windows服务器,因为移动邮件没有发送.这是应该发送邮件的代码:function send_contact_form($strName, $strEmail, $strPhone, $strMessage) { $to = 'mymail@mysite.com'; $subject = 'From the site'; $message = '<h...

php – 如何在Nginx配置文件中配置Phalcon【代码】

我正在尝试设置NGINx服务器以使用Phalcon PHP Framework.到目前为止,我一直在寻找互联网上的帮助,但我找不到任何东西…… 我的conf文件是:server { #listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6root /usr/share/nginx/www; index index.php index.html index.htm;# Make site accessible from http://localhost/ server_name localhost;locat...

php – json_encode在windows上返回整数值,在linux上返回字符串【代码】

我最近出现了这个奇怪的问题.我目前正在Windows环境中进行开发,而在Linux服务器上进行部署时,我知道这并不理想,但在此阶段我无法做很多事情. 我所做的只是从数据库获取数据,然后返回结果数组的JSON响应,但结果不同导致我的前端应用程序出现问题. 我在Windows上得到这个:{"id":40,"name":"test" }这在Linux上:{"id":"40","name":"test" }我实际上使用的是Laravel框架,所以语法就是这样:$user = User::find($id); return Response...

如何调试PHP中的“致命错误:允许的内存大小xxx字节耗尽”【代码】

调试“致命错误:允许的内存大小为268435456字节耗尽”错误的最佳策略是什么?我得到的这个错误很奇怪,显然有些错误.导致它的功能是/*** Flush all output buffers for PHP 5.2.** Make sure all output buffers are flushed before our singletons our destroyed.** @since 2.2.0*/ function wp_ob_end_flush_all() {$levels = ob_get_level();for ($i=0; $i<$levels; $i++)ob_end_flush(); }我简单地重新设计了一些我正在研究的代...

centos7安装phpipam进行ip地址管理【图】

phpIPAM是一个开源的IPAM(IP地址管理)项目,使用它可以免费的进行ip地址的管理,使得管理人员能够更加有效的规划和管理ip地址官方网站https://phpipam.net/ 项目github地址https://github.com/phpipam/phpipam 一、安装依赖包 前期需要安装相关依赖包,同时关闭防火墙等sed -i /SELINUX/s/enforcing/disabled/ /etc/selinux/config && reboot systemctl disable firewalld systemctl stop firewalld yum install epel-releas...

填充FosElasticaBundle耗尽php内存,可能是内存泄漏?【代码】

我已经安装了FOSElasticaBundle并让它处理我的数据的横截面. 我的问题出现了,我需要使用大约14m行来构建索引.我运行了populate命令,在昨天大约6个小时之后,它出现了10.8%的错误并出现内存错误:PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 52277 bytes) in /var/www/html/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php on line 111正如你所看到的,我已经将我的p...

什么是PHP的mt_rand()最小值以及如何在32位Linux机器上计算32位内插【代码】

mt_rand()允许的最小值是多少? 32位和64位机器的值是否相同?如何使用mt_rand()生成32位整数(请注意,它不需要高度随机)? 背景为什么我要求:我有一个64位开发物理服务器和一个32位生产VPS.刚刚意识到生产服务器没有产生跨越整个范围的PK.为了弄清楚发生了什么,我运行了以下脚本. 64位机器永远不会(或者至少我从未目睹)匹配,但32位匹配大约50%的时间.<?phpdate_default_timezone_set('America/Los_Angeles'); ini_set('display_e...

无法使用PHP shell_exec()执行telnet命令【代码】

我正在尝试使用telnet和php进行邮件验证.整个过程在终端中说得很好,但是当我使用php shell_exec()时,它只运行到Telnet连接命令.连接telnet后,剩余的特定于telnet的命令将不再起作用. 有没有其他方法,我们需要使用PHP执行telnet? 更新:我正在尝试复制this教程. 这是我的代码public function mailtest(Request $request){//Taking input email$email = $request->input("email");$divide = explode("@", $email);//Find out the Do...

PHP cURL无法在Windows上的Apache中正确加载【代码】

我最近从头开始设置apache php mysql,除了PHP的cURL,imap和interbase扩展外,一切似乎都运行正常 ext目录包含所有必需的dll,包括php_curl.dll和其他提到的扩展,但是,在错误日志中,以下内容即将发布PHP Warning: PHP Startup: Unable to load dynamic library 'B:/XServ/host/php/ext\\php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic libr...

pecl / mongo需要PHP(版本> = 5.3.0,版本<= 5.99.99),安装版本是7.0.4-7ubuntu2.1没有找到有效的软件包安装失败

我想连接lampp到mongodb所以我需要安装mongodb客户端,我做sudo pecl install mongo il m’affiche le message suivant:PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/20151012/mongo.so’ – /usr/lib/php/20151012/mongo.so: undefined symbol: zval_used_for_init in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/20151012/php_mongo.dll’ – /...

php – 如何使用相同的域在NGINX服务器上运行django和wordpress?【代码】

我尝试了很多方法但不知道如何在example.com上运行Django和在example.com/blog上运行wordpress 以下是Django和Wordpress的运行项目目录结构. Django app dir- / home / ubuntu / django Django app成功运行 – example.com:8000 WordPress目录 – / var / www / html / blog WordPress成功运行 – example.com Nginx配置server {listen 80 default_server;listen [::]:80 default_server ipv6only=on;root /var/www/html/blog;i...