Articles of PHP

Web服务器在Debian虚拟机上不可用

我已经build立了一个虚拟的debian机器,在我的windows系统上运行(使用VirtualBox)来开发LAMP堆栈。 今天,当我尝试从我的Windows机器加载一个开发网站的浏览器没有得到我的虚拟机的响应。 我不是一个Linuxpipe理员; 这是我可以告诉你的: 浏览器从来没有得到答复,但也没有得到任何500错误。 它只是坐在旋转的车轮.. 昨天我在虚拟机上做了一些工作来构buildphp imagick.so可执行文件,所以我可以使用一些pdf编辑库。 这些变化(最终)基本上是这样的: $ apt-get更新php5-devel $ apt-get update make $ apt-get安装php-pear $ apt-get install libmagickwand-dev $ pecl install imagick 在做出这些改变之前,我做了一个虚拟机的快照。 当我遇到这个问题时,我closures了修改后的虚拟机,启动了我之前的快照。 这没有区别 – 同样的Web服务器问题。 从我的Windows机器,我可以ping我的虚拟机在预期的IP(192.168.1.222) 但是,我不能 ping通80端口。我得到一个“无法find主机192.168.1.222:80响应。 以前我能够重新启动Apache没有任何明显的问题,但刚才我做/etc/init.d/apache2停止然后开始,我第一次得到这个: 编辑:以root身份重新启动Apache后更新的问题 停止/启动服务器: root@debian:/home/brd# /etc/init.d/apache2 stop Stopping web server: apache2 … waiting . root@debian:/home/brd# /etc/init.d/apache2 start Starting web server: apache2. Apache似乎重新启动没有投诉 root@debian:/home/brd# […]

Sendmail不会发送到同一个域

我在我的web服务器上使用sendmail,到目前为止工作正常。 但是,当我发送电子邮件到我发送他们的同一个域名,他们从来没有得到交付。 我暂时将我的应用程序中的电子邮件信息更改为另一个域,此时它发送到我的域邮件帐户没有问题。 // does not work $from = '[email protected]' $to = '[email protected]' // works fine $from = '[email protected]' $to = '[email protected]' 此外,运行的服务器是一个单独的服务器,具有设置邮件帐户和域的服务器。 (+我在Linux上) sendmail使用默认configuration。 我试过用下面的命令testing,但是我似乎得到了一堆未经validation的发送错误。 当我用我的gmail帐户来做这件事的时候,它通过了OK。 echo -e "To: [email protected]\nSubject: Test\nTest\n" | sendmail -bm -t -v 编辑 事实certificate,它只是需要它的电子邮件地址来存在。 有什么办法可以绕过这个吗?

升级ImageMagick RHEL 5

我们已经使用ImageMagick很长一段时间没有任何麻烦。 但是,今天我们可以通过一个PDF格式转换成一个jpg的缩略图,这将会失败: $ convert example.pdf -resize 600 thumb.jpg Error: /rangecheck in –run– Operand stack: –dict:12/21(L)– Sh5 0.0 –nostringval– true 14460 0 –nostringval– Execution stack: %interp_exit .runexec2 –nostringval– –nostringval– –nostringval– 2 %stopped_push –nostringval– –nostringval– –nostringval– false 1 %stopped_push 1846 1 3 %oparray_pop 1845 1 3 %oparray_pop 1829 1 3 %oparray_pop –nostringval– –nostringval– 2 1 1 –nostringval– […]

无法通过PHP从EC2连接到RDS。 我可以直接思考

我已经build立了一个EC2实例,它安装了mysql和php-mysql(不是mysql-server)。 我已经设置了RDS实例,并将安全组设置为EC2实例。 我可以通过命令行从EC2连接,但是当我尝试通过mysqli连接时,我得到的消息:不能连接到'XXXX.xxxxxxx.us-east-1.rds.amazonaws.com'MySQL服务器' 这是我第一次和他们合作。 我在这里错过了什么? define("HOST", "XXXX.xxxxxxx.us-east-1.rds.amazonaws.com"); define("DBUSER", "my_user"); define("PASS", "********"); define("DB", "mydb"); define("PORT", 3306); $link=mysqli_connect(HOST,DBUSER,PASS,DB,PORT); // Check connection if (mysqli_connect_errno($link)){ echo "Failure to connect: " . mysqli_connect_error(); } mysqli_close($link);

是从PHP连接到不同的MySQL服务器100%安全吗?

我试图find这个信息,但没有能力。 如何处理从PHP到MySQL服务器的连接。 由于密码是平淡无奇的,如果它被存储在不同的服务器上,它是否也被发送到MySQL? 有没有办法让一个“中间人”拦截密码? 提前致谢, 塞巴斯蒂安

在Centos 6.3上安装GD

大家好,我正尝试在我的CentOS 6.3机器上运行lighttpd作为Web服务器,在我的PHP安装中启用GD。 我已经做了yum install gd gd-php ,当我运行php -i我得到 gd GD Support => enabled GD Version => bundled (2.0.34 compatible) FreeType Support => enabled FreeType Linkage => with freetype FreeType Version => 2.3.11 GIF Read Support => enabled GIF Create Support => enabled JPEG Support => enabled libJPEG Version => 6b PNG Support => enabled libPNG […]

Nginx,PHP-FPM和多个域

我是nginx和php-fpm的新手。 我的问题: 我需要创build两个php-fpmconfiguration文件还是只有一个? 可以两个nginx的configuration(不同的域名/应用程序)指向相同的PHP套接字? 如果是这样会导致会话冲突或任何其他问题? 下面有两个nginxconfiguration和一个php-fpmconfiguration。 如上所述,我应该有两个php-fpmconfiguration? php-fpmconfiguration: [appname1] listen = /var/www/apps/appname1/tmp/php.sock user = www-data group = www-data pm = dynamic pm.max_children = <%= node['php5-fpm']['max_children'] %> pm.start_servers = <%= node['php5-fpm']['start_servers'] %> pm.min_spare_servers = <%= node['php5-fpm']['min_spare_servers'] %> pm.max_spare_servers = <%= node['php5-fpm']['max_spare_servers'] %> pm.max_requests = 1000 pm.status_path = /php_status request_terminate_timeout = 0 request_slowlog_timeout = 0 slowlog = […]

php-libvirt在centos上的安装失败

我正在尝试在centos 6.4 64x上安装php-libvirt ,并在./configure步骤中出现错误: checking for LIBVIRT… configure: error: Package requirements (libvirt >= 0.6.2) were not met: No package 'libvirt' found Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBVIRT_CFLAGS and LIBVIRT_LIBS to avoid the need to call pkg-config. See the pkg-config […]

Apache + PHP-FPM + chroot结果“文件未find”错误

我想使用PHP-FPM池的chroot属性将chroot设置为DocumentRoot。 使用下面的设置,无论我做什么,我只得到一个“文件未find”。 错误: /etc/php5/fpm/pool.d/example.conf [example] user = example group = example listen = /var/run/php_fpm_example.sock pm = dynamic pm.max_children = 5 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 chroot = /opt/jail/example/home/example php_admin_value[open_basedir]=/opt/jail/example/home/example 在/ etc / apache2的/启用的站点 – /例子 <VirtualHost *:80> ServerName example.domain.name ServerAlias www.example.domain.name DocumentRoot /opt/jail/example/home/example <Directory /opt/jail/example/home/example> AllowOverride All Order Allow,Deny Allow from […]

如何在nginx位置块中设置一个PHP-FPMvariables?

出于某种原因,我们的网站有一个.jsphp文件需要交给PHP-FPM。 但是,访问将被拒绝,因为默认情况下,PHP-FPM只允许扩展.php 。 这可以通过将以下内容添加到php-fpm.conf来解决 security.limit_extensions = .php .jsphp 但是我只想为Nginxconfiguration中的特定服务器位置执行此操作,如下所示 location ~ (\.php|\.jsphp)$ { try_files $uri = 404; include /usr/local/etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9001; # 9000 for xdebug fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_VALUE "error_log=/usr/local/var/log/our-website.local-error.log"; } 是否可以添加每个服务器位置的PHP-FPM设置security.limit_extensions ? 如果是这样,我该怎么做? 谢谢!