sudo apt-get install mysql-server-5.5 sudo apt-get install apache2 sudo apt-get install php5 php5-mysql sudo apt-get install libapache2-mod-php5
vi /var/www/index.htmlphp
<!DOCTYPE html> <html> <body> <?php echo "My first PHP script!"; ?> </body> </html>
浏览器打开 http://localhost/index.php 看到内容:My first PHP script!
,说明apahe2和php已安装成功。html
测试php脚本中是否能链接mysqlmysql
shen@debian:/var/www/shm_fast$ cat connect-mysql.php <?php $servername = "localhost"; $username = "root"; $password = "123456"; // 建立链接 $conn = mysqli_connect($servername, $username, $password); // 检测链接 if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?>
shen@debian:/var/www/shm_fast$ php -f connect-mysql.php Connected successfully
浏览器中输入: http://localhost/shm_fast/connect-mysql.php
看到网页输出: Connected successfully 表示mysql安装正确。web
sudo apt-get install phpmyadmin
安装中选择apache2做为web server。redis
在Debain桌面,打开菜单: 应用程序 > 编程 > phpMyAdmin, 或者浏览器中输入http://localhost/phpmyadmin/
能打开phpmyadmin登陆页面,以root账号登陆,若是成功说明phpmyadmin已安装成功。sql
phpMyAdmin版本信息: 3.4.11.1deb2+deb7u1apache
apt-get install mysql-workbench
安装完成后,在Debain桌面,打开菜单: 应用程序 > 编程 > MySQL Workbench, 便可打开桌面应用MySQL Workbench编程
安装后的版本号是5.2.40数组
sudo apt-get install redis-server
版本2.4.14浏览器
shen@debian:~$ redis-server --version Redis server version 2.4.14 (00000000:0)
shen@debian:~$ sudo /etc/init.d/redis-server status redis-server is running
安装PHP包管理器——pear
sudo apt-get install php-pear
sudo apt-get install php5-dev
打开网站 http://pecl.php.net/ 搜索 redis,进入 http://pecl.php.net/package/redis
sudo pear install http://pecl.php.net/get/redis-2.2.7.tgz ... Build process completed successfully Installing '/usr/lib/php5/20100525/redis.so' install ok: channel://pecl.php.net/redis-2.2.7 configuration option "php_ini" is not set to php.ini location You should add "extension=redis.so" to php.ini
sudo vi /etc/php5/mods-available/redis.ini
shen@debian:~$ cat /etc/php5/mods-available/redis.ini ; configuration for php redis module ; priority=20 extension=redis.so
shen@debian:/etc/php5/conf.d$ sudo ln -snf ../mods-available/redis.ini 20-redis.ini shen@debian:/etc/php5/conf.d$ ls -l 总用量 0 lrwxrwxrwx 1 root root 25 8月 31 13:36 10-pdo.ini -> ../mods-available/pdo.ini lrwxrwxrwx 1 root root 24 9月 5 10:02 20-gd.ini -> ../mods-available/gd.ini lrwxrwxrwx 1 root root 28 9月 5 10:02 20-mcrypt.ini -> ../mods-available/mcrypt.ini lrwxrwxrwx 1 root root 28 8月 31 13:36 20-mysqli.ini -> ../mods-available/mysqli.ini lrwxrwxrwx 1 root root 27 8月 31 13:36 20-mysql.ini -> ../mods-available/mysql.ini lrwxrwxrwx 1 root root 31 8月 31 13:36 20-pdo_mysql.ini -> ../mods-available/pdo_mysql.ini lrwxrwxrwx 1 root root 27 9月 9 09:41 20-redis.ini -> ../mods-available/redis.ini
重启apache
shen@debian:~$ sudo /etc/init.d/apache2 restart [ ok ] Restarting web server: apache2 ... waiting .
sudo pear install MDB2 sudo pear install MDB2#mysql sudo pear install PHP_Debug
测试curl代码:
shen@debian:~$ cat curl_version.php <?php // 获取cURL版本数组 $version = curl_version(); // 在cURL编译版本中使用位域来检查某些特性 $bitfields = Array( 'CURL_VERSION_IPV6', 'CURL_VERSION_KERBEROS4', 'CURL_VERSION_SSL', 'CURL_VERSION_LIBZ' ); foreach($bitfields as $feature) { echo $feature . ($version['features'] & constant($feature) ? ' matches' : ' does not match'); echo PHP_EOL; } ?>
安装以前运行错误:
shen@debian:~$ php -f curl_version.php PHP Fatal error: Call to undefined function curl_version() in /home/shen/curl_version.php on line 3
安装并测试:
shen@debian:~$ sudo apt-get install php5-curl shen@debian:~$ php -f curl_version.php CURL_VERSION_IPV6 matches CURL_VERSION_KERBEROS4 does not match CURL_VERSION_SSL matches CURL_VERSION_LIBZ matches