Articles of PHP

apc.shm_size:正确的值格式

关于如何和文档,我通常find这种格式 apc.shm_size=512M 但在我的服务器之一APC 3.0.19不喜欢“M”和崩溃的Apache [apc-error] apc_mmap: mmap failed: Cannot allocate memory 使用相同的Debian Lenny,相同的PHP 5.2.17-dotdeb,但是apc 3.1.6,运行良好,不pipe有没有“M”。 用apc 3.1.7,我得到每个PHP-cli执行或apache重新启动的警告 PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0 女巫APC版本需要的单位,至less有一个不喜欢它?

问题在MySQL数据库。 在服务器上的错误,并在当地工作正常

我有一个问题,我不知道问题在哪里。 在本地系统上一切工作正常与PHP和MySQL,但在现场服务器,我从MySQL的错误,一些列没有默认值。 我知道我应该插入列的默认值或在表架构中设置适当的定义。 但有没有人有关于什么MySQLconfiguration造成这种想法。 所以我可以改变我的本地configuration采取这一点,并得到像生产服务器的错误。 现在几年前我做了一个testing。 在本地和服务器上运行这个脚本。 <?php mysql_connect('localhost','*****','*****') or die(mysql_error()); mysql_select_db('****') or die(mysql_error()); var_dump(mysql_query('INSERT INTO `advertise` set name_en=\'\'') or die(mysql_error())); ?> 在本地的回声boolean true 在服务器上它的echo Field 'name_ar' doesn't have a default value 这里是我从phpmyadmin导出的表架构 — — Table structure for table `advertise` — CREATE TABLE IF NOT EXISTS `advertise` ( `id` int(11) NOT NULL AUTO_INCREMENT, `uid` varchar(255) […]

在RedHat上升级PHP

我试图将我的PHP从5.3.13升级到5.5 后 ,这个链接http://www.if-not-true-then-false.com/2010/install-apache-php-on-fedora- centos-red-hat-rhel / 。 但是,在添加存储库的第一步中收到了错误消息: $ sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-4.rpm error: Failed dependencies: epel-release >= 4 is needed by remi-release-4-7.el4.remi.noarch $ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm error: Failed dependencies: fedora-release conflicts with epel-release-4-10.noarch 我正在使用Red Hat 4.6.1: $ cat /proc/version Linux version 2.6.40.6-0.fc15.x86_64 ([email protected]) (gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) ) #1 SMP […]

Nginx的,PHP和URL与他们的PHP文件

我刚刚安装了一个moodle,它的主题是这样的: http://moodle.example.com/theme/styles.php/standard/1380191797/all nginx没有select那个对PHP文件的调用,并且用404代替。 我目前的重写技术围绕着/index.php引用, /index.php可能过时了,但是之前它已经在很多事情上做了很多工作。 这是我目前的configuration。 server { listen 80; server_name moodle.example.com; root /websites/sbmoodle/moodle; index index.php; location / { try_files $uri $uri/ /index.php$request_uri /index.php; } location ~ \.php($|/) { try_files $uri =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name$fastcgi_path_info; fastcgi_pass unix:/var/run/php5-fpm.sock; } } 现在我看看Stack Exchange的冷光,在它的末尾( \.php($|/) ),我觉得应该抓住这些。 但是nginx仍然需要404s。 为什么? 是的,我已经testing/theme/styles.php (没有以下path),它工作正常。

在CentOS 6上安装mcrypt扩展

我试图在我的CentOS 6 VPS上安装mcrypt扩展。 我已经完成了EPEL rpm,然后更新了一切。 现在,我不断收到这个错误,我也安装了php-api。 [root@vps ~]# yum -y install php-mcrypt Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.raystedman.net * epel: mirror.oss.ou.edu * extras: mirror.teklinks.com * updates: bay.uchicago.edu Setting up Install Process Resolving Dependencies –> Running transaction check —> Package php-mcrypt.x86_64 0:5.1.6-5.el5 will be installed –> Processing Dependency: php-api = […]

PHP脚本在本地MAMP服务器上工作,但不是IIS 8服务器

我有一个PHP脚本,显示在我build立在本地机器上的网站中embedded的Tweets。 当我将该网站上传到IIS 8.0服务器时,PHP脚本不再起作用,并且收到此错误消息: 警告:为第76行的C:\ inetpub \ wwwroot \ i360_new \ footer.php中的foreach()提供的无效参数 脚本是: <?php ini_set('display_errors', 1); require_once('TwitterAPIExchange.php'); /** Set access tokens here – see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "xxxxx", 'oauth_access_token_secret' => "xxxxx", 'consumer_key' => "xxxxx", 'consumer_secret' => "xxxxx" ); /** Perform a GET request and echo the response **/ /** Note: Set the […]

nginx&PHP:别名块中的try_files

我有一个别名的nginx设置,并试图用try_files做一个重写规则。 问题在于它预先提供了文档根目录而没有find该文件。 组态: server { listen 80; server_name mysite.com; root /var/www/default; index index.html index.htm index.php; location /coolapp { alias /home/myhome/coolapp/www/; index index.php; try_files $uri $uri/ /home/myhome/coolapp/www/index.php?url=$uri&$args; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; } } } 并在nginx错误日志中: [error] 21903#0: *2 open() "/var/www/default/home/myhome/coolapp/www/index.php" failed (2: No such file or directory) […]

PHP服务器设置限制后期查询

我有PHP脚本托pipe,接收大数据与Ajax /职位。 刚才在主持一些作品之后,我发现脚本已经坏了。 我检查curl: 文件temp1: user_avatar=&user_baner=&user_sig=…. 总计237个字,和 curl -H "X-Requested-With: XMLHttpRequest" -X POST –data @temp1 'http://host/mypage.php' 作品完美。 但是用文件temp2: name=%D0%9C%D0%B5%D0%B1%%B5%D0%BB%D1%8C%D0%A4%%B0%D0%B1%D1%80%D0%B8%D0%BA%D1%8A&user_payed=0000-00-00&…positions%5B5231%5D=on 总字数:65563 curl -H "X-Requested-With: XMLHttpRequest" -X POST –data @temp2 'http://host/mypage.php' curl没有任何回报。 看起来像apache / php / php.ini或类似的问题。 我检查.htaccess php_value post_max_size 20M 我应该检查哪些其他参数? %BO编码杀死php / apache有可能吗? 或总数参数(约2800)?

Nginx尝试在重写不存在的URL时下载文件

所有对不存在文件的请求都应该被重写到index.php?name = $ 1 所有其他请求应该照常处理。 有了这个服务器块,服务器正试图下载所有不存在的url: server { server_name www.domain.com; rewrite ^(.*) http://domain.com$1 permanent; } server { listen 80; server_name domain.com; client_max_body_size 500M; index index.php index.html index.htm; root /home/username/public_html; location ~ /\.ht { deny all; } location ~ \.php$ { try_files $uri = 404; fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9002; […]

如何正确防止504网关超时?

我有一个脚本可以运行大约15分钟,因为它是一个大型的数据迁移工具。 我有这个问题,如果我设置fastcgi_read_timeout 9900; 它永远不会超时,或者如果我把它设置为更less,那么在我的脚本完成运行之前超时。 编辑:我拿走了fastcgi_read_timeout 9900; 从nginx.conf设置max_execution_time = 1300; 在php.ini中,我现在得到一个504网关超时,而不是永远循环。 我怎样才能正确地设置页面应该是活的,直到脚本完成执行?