LAMP最新配置方法

LAMP最新配置方法,第1张

概述设置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 Enterpris 设置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 总结

以上是内存溢出为你收集整理的LAMP最新配置方法全部内容,希望文章能够帮你解决LAMP最新配置方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1175777.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存