1、测试php安装是否正确
[root@jira121 auto_test_install_envirment]# more info.php
<?php phpinfo(); ?>
2、测试php mysql扩展安装是否正确
<?php
$dbh = new PDO("mysql:host=localhost;dbname=mysql","root","");
$query = "select * from user;";
$result = $dbh->query($query);
$rows = $result->fetchAll();
foreach($rows as $row)
{
$ym = $row[0];
$user = $row[1];
$ps = $row[2];
printf("id-".$ym." order_id-".$user." account_id-".$ps);
print("</br>");
}
$dbh = null;
?>
3、测试php redis扩展安装是否正确
[root@jira121 auto_test_install_envirment]# more phpredis.php<?php
$redis = new Redis();
$redis->connect('127.0.0.1',6379);
$redis->set('testkey',23);
echo $redis->get('testkey');
?>
4、测试python mysqldb驱动安装是否正确
[root@jira121 auto_test_install_envirment]# more test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import MySQLdb as msd
conn = msd.connect(host="127.0.0.1",user="root",passwd="root",db="test")
cursor = conn.cursor()
cursor.execute('select area_name, count(area_id) from baby_enum_area')
for i in cursor.fetchall():
print i
cursor.close()
conn.close()