CF에서 PHP 확장모듈 사용하기

1 개요[ | ]

CF에 PHP 앱 올려보기 3
CF에서 PHP 확장모듈 사용하기
기본으로 사용가능한 모듈에 대해서는 CF PHP 모듈 확인 참조
root@zetawiki:~/my-php-app3# tree -a
.
├── .bp-config
│   └── options.json
├── htdocs
│   └── index.php
└── manifest.yml

2 directories, 3 files

2 앱 작성[ | ]

root@zetawiki:~# mkdir my-php-app3
root@zetawiki:~# mkdir my-php-app3/htdocs
root@zetawiki:~# mkdir my-php-app3/.bp-config
root@zetawiki:~# cd my-php-app3/
root@zetawiki:~/my-php-app3# vi manifest.yml
---
applications:
- name: my-php-app3
  memory: 32M
root@zetawiki:~/my-php-app3# vi .bp-config/options.json
{
    "PHP_EXTENSIONS": ["gd"]
}
root@zetawiki:~/my-php-app3# vi htdocs/index.php
<?php
function image2html( $image ) {
	ob_start();
	imagepng( $image );
	$data = ob_get_contents();
	ob_end_clean();
	return "<img src='data:image/png;base64,".base64_encode($data)."'>";
}
$black_box = imagecreate( 100, 200 );
imagecolorallocate( $black_box, 0, 0, 0 );
$red_box = imagecreate( 100, 200 );
imagecolorallocate( $red_box, 255, 0, 0 );

echo image2html( $black_box );
echo image2html( $red_box );

3 cf push[ | ]

root@zetawiki:~/my-php-app3# cf push
Using manifest file /root/my-php-app3/manifest.yml

Creating app my-php-app3 in org cloudpack / space testuser03 as testuser03...
OK

Creating route my-php-app3.devpack.co.kr...
OK

Binding my-php-app3.devpack.co.kr to my-php-app3...
OK

Uploading my-php-app3...
Uploading app files from: /root/my-php-app3
Uploading 948B, 4 files
Done uploading
... (생략)
     state     since                    cpu    memory         disk           details
#0   running   2016-08-11 05:29:14 PM   0.0%   22.2M of 32M   124.7M of 1G

4 확인[ | ]

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}