时间:2017年03月09日 | 作者 : liuhui | 分类 : Linux | 浏览: 7511次 | 评论 1 人
阿里云限量代金券 | 此广告位出租25元/月 |
是用原厂提供的image直接刷到16G TF卡中, 4GB卡都足够。Linux 只有600MB多点,版本信息如下:
root@FriendlyARM:/# uname -aLinux FriendlyARM 3.4.39-h3 #14 SMP PREEMPT Mon Jul 4 10:10:33 CST 2016 armv7l armv7l armv7l GNU/Linuxroot@FriendlyARM:/#root@FriendlyARM:/# uname -aLinux FriendlyARM 3.4.39-h3 #14 SMP PREEMPT Mon Jul 4 10:10:33 CST 2016 armv7l armv7l armv7l GNU/Linuxroot@FriendlyARM:/#root@FriendlyARM:/# cat /proc/versionLinux version 3.4.39-h3 (root@wwd-ubuntu) (gcc version 4.6.3 20120201 (prerelease) (crosstool-NG linaro-1.13.1-2012.02-20120222 - Linaro GCC 2012.02) ) #14 SMP PREEMPT Mon Jul 4 10:10:33 CST 2016root@FriendlyARM:/#root@FriendlyARM:/# cat /etc/issueUbuntu 15.10 \n \l
安装顺序我是MySQL, Apache, PHP, 因为MySQL最大,都是在线安装的。
MySQL 5.6.31 : 266MB ,
php5.6.11 : 20MB ,
apache2 2.4.12: 11MB
root@FriendlyARM:/# apt-get update Hit http://ports.ubuntu.com wily InReleaseHit http://ports.ubuntu.com wily-updates InReleaseHit http://ports.ubuntu.com wily-security InReleaseHit http://ports.ubuntu.com wily/main SourcesHit http://ports.ubuntu.com wily/restricted SourcesHit http://ports.ubuntu.com wily/main armhf PackagesHit http://ports.ubuntu.com wily/restricted armhf PackagesHit http://ports.ubuntu.com wily/main Translation-enHit http://ports.ubuntu.com wily/restricted Translation-enHit http://ports.ubuntu.com wily-updates/main SourcesHit http://ports.ubuntu.com wily-updates/restricted SourcesHit http://ports.ubuntu.com wily-updates/main armhf PackagesHit http://ports.ubuntu.com wily-updates/restricted armhf PackagesHit http://ports.ubuntu.com wily-updates/main Translation-enHit http://ports.ubuntu.com wily-updates/restricted Translation-enHit http://ports.ubuntu.com wily-security/main SourcesHit http://ports.ubuntu.com wily-security/restricted SourcesHit http://ports.ubuntu.com wily-security/main armhf PackagesHit http://ports.ubuntu.com wily-security/restricted armhf PackagesHit http://ports.ubuntu.com wily-security/main Translation-enHit http://ports.ubuntu.com wily-security/restricted Translation-enReading package lists... Done root@FriendlyARM:/#root@FriendlyARM:/# apt-get install apt-utilsReading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: apt-utils1 upgraded, 0 newly installed, 0 to remove and 44 not upgraded. Need to get 169 kB of archives. After this operation, 0 B of additional disk space will be used.Get:1 http://ports.ubuntu.com/ubuntu-ports/ wily-updates/main apt-utils armhf 1.0.10.2ubuntu3 [169 kB]Fetched 169 kB in 2s (68.2 kB/s) (Reading database ... 24210 files and directories currently installed.) Preparing to unpack .../apt-utils_1.0.10.2ubuntu3_armhf.deb ... Unpacking apt-utils (1.0.10.2ubuntu3) over (1.0.10.2ubuntu2) ... Setting up apt-utils (1.0.10.2ubuntu3) ... root@FriendlyARM:/#
root@FriendlyARM:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 3.6G 603M 3.0G 17% / devtmpfs 168M 0 168M 0% /dev tmpfs 248M 0 248M 0% /dev/shm tmpfs 248M 8.4M 240M 4% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 248M 0 248M 0% /sys/fs/cgroup root@FriendlyARM:~# apt-get install mysql-server Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.6 mysql-client-core-5.6 mysql-common mysql-server-5.6 mysql-server-core-5.6Suggested packages: libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libipc-sharedcache-perl mailx tinyca The following NEW packages will be installed: libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.6 mysql-client-core-5.6 mysql-common mysql-server mysql-server-5.6 mysql-server-core-5.60 upgraded, 12 newly installed, 0 to remove and 45 not upgraded. Need to get 18.9 MB of archives. After this operation, 132 MB of additional disk space will be used. Do you want to continue? [Y/n] Filesystem Size Used Avail Use% Mounted on /dev/root 3.6G 859M 2.7G 24% / devtmpfs 168M 0 168M 0% /dev tmpfs 248M 0 248M 0% /dev/shm tmpfs 248M 8.4M 240M 4% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 248M 0 248M 0% /sys/fs/cgroup root@FriendlyARM:~#root@FriendlyARM:~#root@FriendlyARM:~# apt-get install apache2 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libkrb5-26-heimdal libldap-2.4-2 liblua5.1-0 libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db libwind0-heimdal ssl-cert Suggested packages: www-browser apache2-doc apache2-suexec-pristine apache2-suexec-custom ufw libsasl2-modules-otp libsasl2-modules-ldap libsasl2-modules-sql libsasl2-modules-gssapi-mit libsasl2-modules-gssapi-heimdal openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libkrb5-26-heimdal libldap-2.4-2 liblua5.1-0 libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db libwind0-heimdal ssl-cert0 upgraded, 23 newly installed, 0 to remove and 45 not upgraded. Need to get 2288 kB of archives. After this operation, 7704 kB of additional disk space will be used. Do you want to continue? [Y/n] root@FriendlyARM:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 3.6G 870M 2.7G 25% / devtmpfs 168M 0 168M 0% /dev tmpfs 248M 0 248M 0% /dev/shm tmpfs 248M 8.4M 240M 4% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 248M 0 248M 0% /sys/fs/cgroup root@FriendlyARM:~#root@FriendlyARM:~#root@FriendlyARM:~# apt-get install php5 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libapache2-mod-php5 libjson-c2 lsof php5-cli php5-common php5-json php5-readline ucf Suggested packages: php-pear php5-user-cache The following NEW packages will be installed: libapache2-mod-php5 libjson-c2 lsof php5 php5-cli php5-common php5-json php5-readline ucf0 upgraded, 9 newly installed, 0 to remove and 45 not upgraded. Need to get 4795 kB of archives. After this operation, 16.3 MB of additional disk space will be used. Do you want to continue? [Y/n] root@FriendlyARM:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 3.6G 890M 2.7G 25% / devtmpfs 168M 0 168M 0% /dev tmpfs 248M 0 248M 0% /dev/shm tmpfs 248M 8.4M 240M 4% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 248M 0 248M 0% /sys/fs/cgroup root@FriendlyARM:/# apache2 -v Server version: Apache/2.4.12 (Ubuntu) Server built: Jul 15 2016 15:32:10root@FriendlyARM:/# root@FriendlyARM:/# mysql --version mysql Ver 14.14 Distrib 5.6.31, for debian-linux-gnueabihf (armv7l) using EditLine wrapper root@FriendlyARM:/# root@FriendlyARM:/# php5 -v PHP 5.6.11-1ubuntu3.4 (cli) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies root@FriendlyARM:/#
此时打开nanopi的IP地址就能看到apache安装成功的页面
apt-get install php5-mysql
如果不安装这个,就会出现PHP5不能访问MySQL的问题
root@FriendlyARM:/var/www/html# root@FriendlyARM:/var/www/html# apt-get install php5-mysql Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: php5-mysql0 upgraded, 1 newly installed, 0 to remove and 45 not upgraded. Need to get 53.3 kB of archives. After this operation, 171 kB of additional disk space will be used.Get:1 http://ports.ubuntu.com/ubuntu-ports/ wily-updates/main php5-mysql armhf 5.6.11+dfsg-1ubuntu3.4 [53.3 kB]Fetched 53.3 kB in 3s (14.0 kB/s) Selecting previously unselected package php5-mysql. (Reading database ... 22184 files and directories currently installed.) Preparing to unpack .../php5-mysql_5.6.11+dfsg-1ubuntu3.4_armhf.deb ... Unpacking php5-mysql (5.6.11+dfsg-1ubuntu3.4) ... Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ... Setting up php5-mysql (5.6.11+dfsg-1ubuntu3.4) ... Creating config file /etc/php5/mods-available/mysql.ini with new versionphp5_invoke: Enable module mysql for apache2 SAPIphp5_invoke: Enable module mysql for cli SAPI Creating config file /etc/php5/mods-available/mysqli.ini with new versionphp5_invoke: Enable module mysqli for apache2 SAPIphp5_invoke: Enable module mysqli for cli SAPI Creating config file /etc/php5/mods-available/pdo_mysql.ini with new versionphp5_invoke: Enable module pdo_mysql for apache2 SAPIphp5_invoke: Enable module pdo_mysql for cli SAPI Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ... root@FriendlyARM:/var/www/html# root@FriendlyARM:/var/www/html# root@FriendlyARM:/var/www/html# root@FriendlyARM:/var/www/html# df -h Filesystem Size Used Avail Use% Mounted on /dev/root 3.6G 891M 2.7G 25% / devtmpfs 168M 0 168M 0% /dev tmpfs 248M 0 248M 0% /dev/shm tmpfs 248M 8.4M 240M 4% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 248M 0 248M 0% /sys/fs/cgroup root@FriendlyARM:/var/www/html#
成功安装后,phpinfo()输出的信息中将会看到以下的"php信息1" 及 "php信息2",否则只能看到信息1。当然还有很多其它信息。
1.php
<?phpphpinfo();?>
Multibyte String Functions | Tsukada Takuya, Rui Hirokawa |
MySQL driver for PDO | George Schlossnagle, Wez Furlong, Ilia Alshanetsky, Johannes Schlueter |
MySQL | Zeev Suraski, Zak Greant, Georg Richter, Andrey Hristov |
MySQLi | Zak Greant, Georg Richter, Andrey Hristov, Ulf Wendel |
MySQLnd | Andrey Hristov, Ulf Wendel, Georg Richter, Johannes Schlüter |
MySQL Support | enabled |
---|---|
Active Persistent Links | 0 |
Active Links | 0 |
Client API version | 5.6.31 |
MYSQL_MODULE_TYPE | external |
MYSQL_SOCKET | /var/run/mysqld/mysqld.sock |
MYSQL_INCLUDE | -I/usr/include/mysql |
MYSQL_LIBS | -L/usr/lib/arm-linux-gnueabihf -lmysqlclient_r |
Directive | Local Value | Master Value |
---|---|---|
mysql.allow_local_infile | On | On |
mysql.allow_persistent | On | On |
mysql.connect_timeout | 60 | 60 |
mysql.default_host | no value | no value |
mysql.default_password | no value | no value |
mysql.default_port | no value | no value |
mysql.default_socket | /var/run/mysqld/mysqld.sock | /var/run/mysqld/mysqld.sock |
mysql.default_user | no value | no value |
mysql.max_links | Unlimited | Unlimited |
mysql.max_persistent | Unlimited | Unlimited |
mysql.trace_mode | Off | Off |
MysqlI Support | enabled |
---|---|
Client API library version | 5.6.31 |
Active Persistent Links | 0 |
Inactive Persistent Links | 0 |
Active Links | 0 |
Client API header version | 5.6.30 |
MYSQLI_SOCKET | /var/run/mysqld/mysqld.sock |
Directive | Local Value | Master Value |
---|---|---|
mysqli.allow_local_infile | On | On |
mysqli.allow_persistent | On | On |
mysqli.default_host | no value | no value |
mysqli.default_port | 3306 | 3306 |
mysqli.default_pw | no value | no value |
mysqli.default_socket | /var/run/mysqld/mysqld.sock | /var/run/mysqld/mysqld.sock |
mysqli.default_user | no value | no value |
mysqli.max_links | Unlimited | Unlimited |
mysqli.max_persistent | Unlimited | Unlimited |
mysqli.reconnect | Off | Off |
mysqli.rollback_on_cached_plink | Off | Off |
PDO support | enabled |
---|---|
PDO drivers | mysql |
PDO Driver for MySQL | enabled |
---|---|
Client API version | 5.6.31 |
Directive | Local Value | Master Value |
---|---|---|
pdo_mysql.default_socket | /var/run/mysqld/mysqld.sock | /var/run/mysqld/mysqld.sock |
登录MySQL
创建数据库x
创建表p
每访问一次就插入一条记录
<!DOCTYPE html><html><body><h1>我的第一张 PHP 页面</h1><br> this is xsz test </br><?phpecho "<br>" . date("y-m-d H:i:s") . "<br>";echo "Hello World!" . "<br><br>"; $servername = "localhost"; $username = "root"; $password = "root"; $con = mysqli_connect($servername, $username, $password);if (!$con) { die("mysql connect FAILURE. " . $con->connect_error); }echo " MYSQL connect OK" . "<br>";echo "</br>" . "sqlserverinfo:" ;print(mysqli_get_server_info($con));echo "</br>"; $sql = "CREATE DATABASE x";if ($con->query($sql) === TRUE) { echo " Create database OK. "; } else { echo "Error creating database: " . $con->error; }echo "</br>";print(mysqli_select_db($con,"x"));echo "</br>"; $sql = "CREATE TABLE p ( id int UNSIGNED AUTO_INCREMENT PRIMARY KEY, name varchar(30) not null, yo int not null, reg_date TIMESTAMP )";if ($con->query($sql) == TRUE){ echo "create table ok <br>"; } else { echo " create table error" . $con->error; }echo "</br>";print(mysqli_select_db($con,"x")); $r = mysqli_query($con,"SELECT * FROM p");echo "</br>";echo "<table border='1'> <tr> <th>id</th> <th>name</th> <th>age</th> <th>reg date</th> </tr>";while($row = mysqli_fetch_array($r)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['yo'] . "</td>"; echo "<td>" . $row['reg_date'] . "</td>"; echo "</tr>"; }echo "</table>";echo "<br>"; $sql = "INSERT INTO p (name, yo) VALUES ( 'xx" . date("ymd-H:i:s") . "'" . "," . date("His") . ")";print($sql);echo "<br>"; $con->query($sql); mysqli_close($con);echo "<br> finished. " . date("y-m-d H:i:s") . "<br>";?></body></html>
我的第一张 PHP 页面 this is xsz test 16-08-21 08:04:27 Hello World! MYSQL connect OK sqlserverinfo:5.6.31-0ubuntu0.15.10.1 Error creating database: Can't create database 'x'; database exists 1create table errorTable 'p' already exists1id name age reg date1 xx160821-04:28:31 42831 2016-08-21 04:28:312 xx160821-04:28:39 42839 2016-08-21 04:28:393 xx160821-04:28:43 42843 2016-08-21 04:28:434 xx160821-04:28:45 42845 2016-08-21 04:28:455 xx160821-04:28:56 42856 2016-08-21 04:28:566 xx160821-04:28:57 42857 2016-08-21 04:28:577 xx160821-04:28:59 42859 2016-08-21 04:28:598 xx160821-04:29:18 42918 2016-08-21 04:29:189 xx160821-04:29:19 42919 2016-08-21 04:29:1910 xx160821-04:29:22 42922 2016-08-21 04:29:2211 xx160821-04:33:28 43328 2016-08-21 04:33:2812 xx160821-07:03:17 70317 2016-08-21 07:03:1713 xx160821-07:03:21 70321 2016-08-21 07:03:2114 xx160821-08:02:52 80252 2016-08-21 08:02:52INSERT INTO p (name, yo) VALUES ( 'xx160821-08:04:27',080427) finished. 16-08-21 08:04:28
以上整个过程除只有MySQL安装过程中要求输入密码外,不需要再对LAMP作任何配置或更改配置文件什么的。
安装完成后只需将1.php, 2.php拷贝到 /var/www/html中, 然后就可以在WEB浏览器中查看效果了。
root@FriendlyARM:/var/www/html# pwd /var/www/html root@FriendlyARM:/var/www/html# ll total 28drwxr-xr-x 2 root root 4096 Aug 21 08:04 ./ drwxr-xr-x 3 root root 4096 Aug 21 04:07 ../ -rw-r--r-- 1 root root 21 Aug 21 04:20 1.php -rw-r--r-- 1 root root 1752 Aug 21 08:04 2.php -rw-r--r-- 1 root root 11321 Aug 21 04:08 index.html
著作权归作者所有
本文转自 OsChina>博客专区 > SamXIAO的博客
原文链接:https://my.oschina.net/SamXIAO/blog/735770
问题:Apache如何开启.htaccess伪静态访问?
以上问题如果有网友知道的请在下方回复,万分感谢!
推荐您阅读更多有关于“”的文章
Powered By Z-Blogphp
分享:
支付宝
微信