ラベル PHP の投稿を表示しています。 すべての投稿を表示
ラベル PHP の投稿を表示しています。 すべての投稿を表示

2012年4月30日月曜日

PHP でのエラーとか

Webからphpにアクセスしても真っ白(何も表示されない)な時は
コンソールから
$php -l {ファイルのパス}
とし シンタックスエラーが無いか確認する
PHP Parse error: syntax error, unexpected '*' in ./Filename.php on line Num
と表示された場合 ./filename.phpNum行目付近でパースできないと行ってるので
その行を確認する

No syntax errors detected in ./filename.php
と表示されればシンタックスエラーは無い
それでも表示されない場合は

$php -a ./{ファイル名}
として実際に実行してみる

そして今回は
PHP Fatal error: Allowed memory size of 838860800 bytes exhausted (tried to allocate 983040 bytes) in /var/www/video/public_html/includes/classes/lang.class.php on line 192
と表示されたので
/etc/php.iniの
memory_limitの量を大きくしhttpdをリロードする
service httpd reload
Reloading httpd: [ OK ]

2010年10月1日金曜日

ClipBucketで動画をアップロードすると500エラーが表示される

ClipBucketで動画をアップロードすると500エラーが表示されるときはまずhttpdのログを確認してみましょう

[root@blog.m264.com ~]$ tail -n 1 /var/log/httpd/error_log
[Thu Sep 30 13:16:19 2010] [error] [client 192.168.3.4] PHP Warning: POST Content-Length of 10948294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0


POST Content-Length of 10948294 bytes exceeds the limit of 8388608 bytes

要は
え??10MBもアップするの!? お話じゃぁ8MBって聞いてたけど・・・・ (´・ω・`)
って行ってるので

10MBでも受け付けてもらえるようにお話を通します←

まずphp.iniを編集します
[root@blog.m264.com ~]$ vim /etc/php.ini
477行のpost_max_sizeを
post_max_size = 100M
とかにしちゃいます
ついでに
582行とかも弄っちゃいます
upload_max_filesize = 100M

いじり終わったら保存しちゃいます
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 200M


;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

"/etc/php.ini" 1222L, 45090C 書込み 582,1 47%
話が通ったようなのでhttpdさんに報告しましょう←
[root@blog.m264.com ~]$ service httpd reload
httpd を再読み込み中: [ OK ]

2010年9月30日木曜日

CentOS5.5にffmpeg-phpをインストールする

CentOS 5.5 に ffmpeg-phpをインストールする方法
下記のパッケージをインストール済みと想定しています
  • wget
  • tar
  • make
  • gcc
  • bzip2
  • php
  • php-devel
  • ffmpeg
  • ffmpeg-devel
ffmpeg-phpをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/ffmpeg-php
解凍しビルドします
[root@blog.m264.com ~]$ tar -xf ./ffmpeg-php-0.6.0.tbz2
[root@blog.m264.com ~]$ cd ./ffmpeg-php-0.6.0
[root@blog.m264.com ~]$ phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025
[root@blog.m264.com ~]$ ./configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
-----

以下略

[root@blog.m264.com ~]$ make
いろいろ出力される

----------------------------------------------------------------------
Libraries have been installed in:
/root/work/wget/ffmpeg-php-0.6.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
正常にメイクできたのでインストールする
[root@blog.m264.com ~]$ make install
Installing shared extensions: /usr/lib/php/modules/
これでインストール完了です最後にhttpdをリロードします
service httpd reload
httpd を再読み込み中: [ OK ]

2010年9月28日火曜日

PHP Fatal error: Allowed memory size of ******** bytes exhausted (tried to allocate ****** bytes)
と表示された場合は単純にメモリーが足りないだけなので
/etc/php.iniの
memory_limitの量を大きくしhttpdをリロードする
service httpd reload
Reloading httpd: [ OK ]
これで実行されるはず

もしphp.iniを弄る権限が無いなら
phpファイルに
ini_set('memory_limit','10M');
と追加すればいい