Tag: MacPorts/php5
$ sudo port install php5 +apache2 +pear
$ sudo port install php5-mbstring
$ sudo port install php5-mysql
$ cd /opt/local/apache2/modules $ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
$ cd /opt/local/apache2/conf $ vi httpd.conf
<IfModule dir_module> DirectoryIndex index.html index.php </IfModule>
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
$ cd /opt/local/etc/php5 $ sudo cp php.ini-development php.ini $ sudo vi php.ini
[mbstring] mbstring.language = Japanese mbstring.internal_encoding = UTF-8 mbstring.http_input = auto mbstring.http_output = UTF-8 mbstring.encoding_translation = On mbstring.detect_order = auto mbstring.substitute_character = none; mbstring.func_overload = 1
$ sudo /opt/local/apache2/bin/apachectrl restart
$ sudo pear channel-discover pear.phpunit.de $ sudo pear channel-discover pear.symfony-project.com $ sudo pear channel-discover pear.symfony.com
$ sudo pear install --alldeps phpunit/PHPUnit
sudo port install php5-xdebug
sudo pear install phpunit
$ sudo port clean php5 $ sudo port install php5 +apache2 +pear
cd /opt/local/apache2/htdocs/ vi info.php
<?php phpinfo(); ?>
sudo port install php5-mysql
/opt/local/var/run/mysql5/mysqld.sock
/opt/local/var/run/mysql55/mysqld.sock
ブラウザのデフォルトエンコーディングとあってない場合UTF-8でそのまま出力すると文字化けするかも。ブラウザによってはでるかもしれないけど、基本的にはcharsetを指定しないとだめ。
<?php header("Content-Type: text/html; charset=UTF-8"); ?>