LAMP最新配置方法

前端之家收集整理的这篇文章主要介绍了LAMP最新配置方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
设置vnc服务端, root下的文件,和sysconfig下的vnc配置文件 设置ip地址 设置开启sshd服务器 准备安装lamp 设置连接windows下的共享目录 mount -t cifs //192.168.5.56/softs /mnt/cifs -o username=administrator,password=a,domain=WORKGROUP RedHat Enterprise Linux 5 中文字体安装 http://www.blogjava.net/fastzch/archive/2009/01/12/250956.html http://hi.baidu.com/motioo/blog/item/789291fc4a2cf2eefd037f12.html :/usr/share/fonts/chinese/TrueType/ RedHat Enterprise Linux 5是RedHat新出的版本,现在需要在RHEL5下面用到一些中文的东西,NND,发现中文全是方框框,怎么办?重装?NO,经过仔细分析,发现是没有支持中文的字 体,所以我想了想,就把我Vista下面的“宋体&新宋体”更新上去。过程如下: 1,cd /usr/share/fonts 2,mkdir truetype 3,cd truetype 4,mkdir simsun 5,使用FTP或SFTP将Vista下的simsun.tcc文件传到/usr/share/fonts/truetype/simsun/目录中 6,执行 mkfontscale 生成了fonts.scale文件 7,执行 mkfontdir 生成了fonts.dir文件 8,chkfontpath --add /usr/share/fonts/truetype/simsun/ 9,service xfs reload 此时,使用Window方式登录,语言选择中文,即可正确显示中文了。 更改启动级别 vi /etc/inittab 设置服务启动级别 [root@localhost ~]# chkconfig --level 35 vncserver on [root@localhost ~]# chkconfig --level 35 sshd on http://www.linuxidc.com/Linux/2007-12/9604p2.htm 1-安装apr 下载地址:http://apr.apache.org/download.cgi Unix Source: apr-1.4.5.tar.gz [PGP] [MD5] [root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr 2-安装 http://mirror.bjtu.edu.cn/apache//apr/ apr-util-1.3.12.tar.gz [root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 3.apache httpd-2.2.22.tar.gz ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-z-dir=/usr/local/zlib 本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2007-12/9604p2.htm ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite --with-expat=builtin # vi /usr/local/apache/conf/httpd.conf #ServerName www.example.com:80 在其下增加 ServerName 127.0.0.1:80 保存退出,现在就这么简单配置apache。 # /usr/local/apache/bin/apachectl -k start 4,安装GD前提条件安装GD库(让PHP支持GIF,PNG,JPEG) ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/lib/ --with-zlib=/usr/lib/ --with-freetype=/usr/local/freetype a.libpng http://www.libpng.org/pub/png/libpng.html libpng-1.5.8.tar.gz # cp scripts/makefile.std makefile # make; make install b.freetype-2.4.8 [root@localhost freetype-2.4.8]# ./configure --prefix=/usr/local/freetype c.jpegsrc.v7.tar.gz ./configure --prefix=/usr/local/jpeg7/ --enable-shared --enable-static 本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http://www.linuxidc.com/Linux/2007-12/9604p2.htm gd安装 linux gd down # tar -zvxf gd-2.0.33.tar.gz # mkdir -p /usr/local/gd2 # cd gd-2.0.33 ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg7/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/ 2------------------------------------------------------------------------------------------------- MysqL ////////////////////////////////////////////////////////////////////////////////// MysqL ./configure --prefix=/usr/local/MysqL --with-charset='utf8' groupadd MysqL useradd MysqL -g MysqL -M -s /bin/false ////////////////////////////////////////////////////////////////////////////////// ./configure --prefix=/usr/local/MysqL --with-charset='utf8' groupadd MysqL useradd MysqL -g MysqL -M -s /bin/false scripts/MysqL_install_db --user=MysqL #./scripts/MysqL_install_db --user=MysqL #./bin/MysqLd_safe --user=MysqL & cp support-files/my-medium.cnf /etc/my.cnf cp support-files/MysqL.server /etc/init.d/MysqLd chmod 700 /etc/init.d/MysqLd cd /usr/local chmod 750 MysqL -R chgrp MysqL MysqL -R chown MysqL MysqL/var -R cd /usr/local/MysqL/libexec cp MysqLd MysqLd.old strip MysqLd chkconfig --add MysqLd chkconfig --level 345 MysqLd on service MysqLd start netstat -atln /usr/local/MysqL/bin/MysqLadmin -uroot password "adminadmin" /usr/local/MysqL/bin/MysqLadmin -u root password "adminadmin" admin%woaiwojia /*[23:44:29][ 63 ms]*/ insert into MysqL.user ( host,user,password,select_priv,insert_priv,update_priv,delete_priv,create_priv,drop_priv,reload_priv,shutdown_priv,process_priv,file_priv,grant_priv,references_priv,index_priv,alter_priv ) values ( '%','a',PASSWORD('woaiwojia'),'Y','Y' ) /*[23:44:29][ 0 ms]*/ flush privileges adminlocalhostwoaiwojia /*[23:45:43][ 0 ms]*/ insert into MysqL.user ( host,alter_priv ) values ( 'localhost','admin','Y' ) /*[23:45:43][ 31 ms]*/ flush privileges MysqL> UPDATE user set password=PASSWORD('yournewpassword') where user='';   MysqL>FLUSH PRIVILEGES; /usr/local/libxml2/bin echo $PATH 1。当前登陆有效 export PATH=/usr/local/libxml2/bin:$PATH 2。 /home/user/.bash_profile PATH=/usr/local/pgsql/bin:$PATH /*[22:33:38][ 0 ms]*/ SHOW VARIABLES LIKE 'lower_case_table_names'; /*[22:33:38][ 0 ms]*/ SET NAMES 'utf8'; /*[22:33:38][ 0 ms]*/ SET sql_mode=''; /*[22:33:38][ 63 ms]*/ SHOW DATABASES; /*[22:33:45][ 0 ms]*/ SELECT * FROM MysqL.user WHERE 1=0; /*[22:33:45][ 0 ms]*/ SELECT USER,HOST FROM MysqL.user; /*[22:33:45][ 0 ms]*/ SELECT * FROM MysqL.user WHERE USER='root' AND HOST ='localhost'; /*[22:34:05][ 0 ms]*/ SELECT * FROM MysqL.user WHERE 1=0; /*[22:34:05][ 0 ms]*/ SELECT USER,HOST FROM MysqL.user; /*[22:34:05][ 0 ms]*/ SELECT * FROM MysqL.user WHERE USER='root' AND HOST ='localhost'; /*[22:35:00][ 0 ms]*/ SELECT * FROM MysqL.user WHERE 1=0; /*[22:35:13][ 16 ms]*/ INSERT INTO MysqL.user ( HOST,USER,PASSWORD,alter_priv,show_db_priv,super_priv,create_tmp_table_priv,lock_tables_priv,execute_priv,repl_slave_priv,repl_client_priv,create_view_priv,show_view_priv,create_routine_priv,alter_routine_priv,create_user_priv ) VALUES ( '%',PASSWORD ('woaiwojia'),'Y' ); /*[22:35:13][ 16 ms]*/ FLUSH PRIVILEGES; [root@localhost MysqL-5.1.55]# scripts/MysqL_install_db --user=MysqL Installing MysqL system tables... OK Filling help tables... OK To start MysqLd at boot time you have to copy support-files/MysqL.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MysqL root USER ! To do so,start the server,then issue the following commands: /usr/local/MysqL/bin/MysqLadmin -u root password 'new-password' /usr/local/MysqL/bin/MysqLadmin -u root -h localhost.localdomain password 'new-password' Alternatively you can run: /usr/local/MysqL/bin/MysqL_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MysqL daemon with: cd /usr/local/MysqL ; /usr/local/MysqL/bin/MysqLd_safe & You can test the MysqL daemon with MysqL-test-run.pl cd /usr/local/MysqL/MysqL-test ; perl MysqL-test-run.pl Please report any problems with the /usr/local/MysqL/bin/MysqLbug script! e.安装Curl库 http://curl.haxx.se/download.html # tar -zxf curl-7.15.0.tar.gz ./configure --prefix=/usr/local/curl --with-krb4 --with-gssapi --with-spnego --enable-ares //新加的,少了几个参数 五:安装PHP5,PHP5必须有libxml2支持! a.安装libxml2 # tar -zxf libxml2-2.6.19.tar.gz # mkdir -p /usr/local/libxml2 # ./configure --prefix=/usr/local/libxml2 b.安装 libxslt(可选安装,你可以不安装) # tar -zxf libxslt-1.1.15.tar.gz # cd libxslt-1.1.15 # ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2 c.添加mssql支持 ./configure --prefix=/usr/local/freetds PHP5.3的情况下,用pdo的dblib驱动无法连接mssql的,根据官方的描述,5.2已经修改这个bug,5.3没有。 用PHP自带的mssql函数可以的。编译freetds,PHP_mssql,pdo_dblib参数如下: ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib ./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config --with-mssql=/usr/local/freetds/ ./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config --with-mssql=/usr/local/freetds --enable-pdo --with-pdo-dblib=/usr/local/freetds/ 用自带mssql函数无法设置字符集,set names 不被支持,最后参考了adodb的代码,发现解决这个问题还得用com,或者用ative mssql driver, 这两东西在windows下可以,linux还是不大 好使的。解决办法是编辑/usr/local/freetds/etc/freetds.conf 加上一行client charset = GBK, 设置成utf-8是不对的,因为mssql排序规则数据库默认设置是Chinese PRC,相当于gb2312, 另外PHP.ini 里面mssql.charset 是不需要设置的,其实说得很清楚: ; Specify client character set. ; If empty or not set the client charset from freetds.comf is used ; This is only used when compiled with FreeTDS 当FreeTDS的client charset 为空或者没有设置的时候才需要设置这个。曾经错误的将这里设置成utf-8,FreeTDS的client charset 也设置成utf8,结果mssql_connect的时候就开始报错了。 最终结论,只需要设置FreeTDS的client charset 为GBK,然后在PHP的程序里面iconv('GBK','UTF-8//IGNORE',$str);一下 就一切正常了 <?PHP $conn=mssql_connect("MyServer70","sa","password"); mssql_select_db('dbname',$conn); $msquery="select firstname,lastname from table"; $msresults=mssql_query($msquery); while ($row=mssql_fetch_array($msresults)) { echo "<li>". $row['titleofcourtesy'] ." ".$row['firstname'] ." ".$row['lastname'] ."</li>n"; } ?> <?PHP try { $hostname='192.168.0.1';//注意,这里和上面不同,要直接用IP地址或主机名 $port=1433;//端口 $dbname="dbname";//库名 $username="sa";//用户 $pw="password";//密码 $dbh= newPDO("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw"); } catch (PDOException $e) { echo"Failed to get DB handle: ".$e->getMessage() ."n"; exit; } echo'connent MSsql succeed'; $stmt=$dbh->prepare("select firstname,lastname from table"); $stmt->execute(); while ($row=$stmt->fetch()) { print_r($row); } unset($dbh); unset($stmt); ?> d添加sqlite支持 --with-sqlite=shared --with-pdo-sqlite=shared ./configure --prefix=/usr/local/PHP --with-apxs2=/usr/local/apache/bin/apxs --with-MysqL=/usr/local/MysqL/ --with-pdo-MysqL=/usr/local/MysqL --with-curl=/usr/local/curl --enable-ftp -- with-libxml-dir=/usr/local/libxml2 --enable-soap --with-xsl=/usr/local/libxslt --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg7/ --with-zlib-dir=/usr/local/lib/ --with-png- dir=/usr/lib/ --with-freetype-dir=/usr/local/freetype/ --enable-mbstring --with-mssql=/usr/local/freetds --enable-pdo --with-pdo-dblib=/usr/local/freetds/ --with-sqlite=shared --with- pdo-sqlite=shared cp PHP.ini-dist /usr/local/PHP/lib/PHP.ini (别忘记了呵呵) AddType application/x-httpd-PHP .PHP(注意空格) AddDefaultCharset ISO-8859-1 (780行)   代码 1:  <html>   <?PHP   $dsn = 'sqlite:sql.db';   try   {   $dbh = new PDO($dsn,$user,$password);    //建立连接   echo 'PDO Connection Ok<BR>';   //建表   $dbh->exec("CREATE TABLE PKU(id integer,name varchar(255))");   //echo 'Create Table ok<BR>   ';   print("Create Table ok<BR>   ");   $dbh->exec("INSERT INTO PKU values(1,'jarjin')");   echo 'Insert Data ok<BR>';   $dbh->beginTransaction();   $sth = $dbh->prepare('SELECT * FROM PKU');   $sth->execute();   //获取结果   $result = $sth->fetchAll();   print_r($result);   $dsn=null;   }   catch (PDOException $e)   {   echo 'Connection Failed: ' . $e->getMessage();   $dsn = null;   }   ?>   </html>   代码 2:   <html>   <?PHP   //$pdo = new PDO('sqlite::memory:');  //内存中的数据库   $pdo = new PDO('sqlite:mydb.db');   $pdo->exec('CREATE TABLE test(ID INT NOT NULL PRIMARY KEY,Field VARCHAR(12) NULL);');   $stmt = $pdo->prepare('INSERT INTO test(ID,Field) VALUES(?,?)');   $one = 1;   $two = 2;   $null = NULL;   // Try with PDO_PARAM_NULL   $stmt->bindParam(1,$one,PDO::PARAM_INT);    //绑定参数   $stmt->bindParam(2,$null,PDO::PARAM_STR);   assert($stmt->execute());   // Try with PDO_PARAM_STR   $stmt->bindParam(1,$two,PDO::PARAM_INT);   $stmt->bindParam(2,PDO::PARAM_STR);   assert($stmt->execute());   // Check we have rows..   $stmt = $pdo->prepare('SELECT * FROM test');   assert($stmt->execute());   var_dump($stmt->fetchAll());   // Check we have rows with field is null   echo '<hr />';   $stmt = $pdo->prepare('SELECT * FROM test WHERE Field IS NULL');   assert($stmt->execute());   var_dump($stmt->fetchAll());    //显示查询结果   ?>   </html> <?PHP try { $hostname='192.168.0.1';//注意,lastname from table"); $stmt->execute(); while ($row=$stmt->fetch()) { print_r($row); } unset($dbh); unset($stmt); ?> linux sqlite安装 以下代码均在终端直接运行即可 wget http://www.sqlite.org/sqlite-3.6.16.tar.gz tar -zxvf sqlite-3.6.16.tar.gz cd sqlite-3.6.16 ./configure make;make install ln -s /usr/local/bin/sqlite3 /usr/bin/sqlite [root@inbelle ipsecmc]# sqlite user.db sqlite version 3.6.16 Enter ".help" for instructions Enter sql statements terminated with a ";" sqlite> sqlite> .tables p2pvpn_client sqlite> select * from p2pvpn_client; group001|test001|123456 group001|test002|123456 group001|test003|123456 group001|test004|123456 group001|test005|123456 group002|test001|123456 group002|test002|123456 group002|test003|123456 group002|test004|123456 group002|test005|123456 sqlite> .schema CREATE TABLE p2pvpn_client( groupname varchar(32) NULL,username varchar(32) NULL,password varchar(32) NULL); sqlite> insert into "p2pvpn_client" values ("group001","test006","123456"); sqlite> select * from p2pvpn_client; group001|test001|123456 group001|test002|123456 group001|test003|123456 group001|test004|123456 group001|test005|123456 group002|test001|123456 group002|test002|123456 group002|test003|123456 group002|test004|123456 group002|test005|123456 group001|test006|123456 sqlite> sqlite> .exit exp1 http://apps.hi.baidu.com/share/detail/33243780 ../bin/tsql -H 192.168.5.56 -p1433 -U a -P a ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld --enable-shared --enable-static client charset = GBK client charset = cp936 # 在/usr/local/PHP/lib/PHP.ini后加入mssql.charset = "GBK" [root@localhost bin]# ./tsql -C Compile-time settings (established with the "configure" script) Version: freetds v0.91 freetds.conf directory: /usr/local/freetds/etc MS db-lib source compatibility: yes Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 5.0 iODBC: no unixodbc: no SSPI "trusted" logins: no Kerberos: no [root@localhost bin]# wget http://blog.csdn.net/yjfkpyu/article/details/4062045 原文链接:https://www.f2er.com/sqlite/202036.html

猜你在找的Sqlite相关文章