linux下安装php环境xampp并配置虚拟域名

假设在此,我们已经在linux上面安装好了xampp。如果还没有安装的同学,可以参考我的上一篇文章 http://www.skyleft.com/index.php/linux%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/php-317.html 进行安装

第一步:

设置xampp随系统自动启动,因为xampp转义是不会随系统自动启动的,命令如下

ln -s /opt/lampp/lampp /etc/rc.d/rc3.d/S99lampp

ln -s /opt/lampp/lampp /etc/rc.d/rc4.d/S99lampp

ln -s /opt/lampp/lampp /etc/rc.d/rc5.d/S99lampp

第二步:修改apache,php等配置文件,配置文件都在/opt /lampp/etc里面
#修改httpd.conf设置,修改用户和用户组为apache,设置默认编码
vi /opt/lampp/etc/httpd.conf
增加
User apache
Group apache
AddDefaultCharset GBK

因为修改了用户和组,需要设置目录权限.
chown -R apache.apache /opt/lampp/htdocs/
chown -R apache.apache /opt/lampp/phpmyadmin/

如果没有apache用户和组要先添加
groupadd apache
useradd -g apache apache

配置完毕需要重启xampp
/opt/lampp/lampp restart

第三步:  xampp 配置独立的域名

打开配置文件:
$ vi /opt/lampp/etc/httpd.conf
找到:
#Include etc/extra/httpd-vhosts.conf
去掉前面的“#”号,再打开文件:
$ vi /opt/lampp/etc/extra/httpd-vhosts.conf
做如下修改:
#虚拟主机VHOST文件
NameVirtualHost *:80

#默认站点
<VirtualHost *:80>
ServerAdmin fanglor@aisuizhou.com
DocumentRoot /opt/lampp/htdocs
ServerName localhost
</VirtualHost>

#站点a
<VirtualHost *:80>
ServerAdmin fanglor@.aisuizhou.com
DocumentRoot /server/www/skyleft
ServerName  skyleft.com
ServerAlias  skyleft.com
</VirtualHost>

配置好后,重量lampp

在/server/www/skyleft 下面建 一个 index.php 里面写上 phpinfo ();

在地址栏里面输入 skyleft.com 看看,是不是能访问了。

centos5.4上安装xampp全过程

1.先下载 XAMPP Linux 1.7.3.tar.gz 安装包。并把它上传到centOs 指定目录下。

2.用命令进到该目录里,执行 tar xvfz xampp-linux-1.7.3.tar.gz -C /opt 把它解压到 /opt下。

3. 执行命令  /opt/lampp/lampp start 运行 lampp ,如果看到以下显示信息,表明启动成功.

Starting XAMPP 1.7.3…

LAMPP: Starting Apache…

LAMPP: Starting MySQL…

LAMPP started.

4.测试 转入http://localhost 如果看到欢迎页面,表明安装成功

如果只是简单的安装环境,到这里就可以了,我们说说它的一些默认设置。

程序 是安装 在 /opt/lampp下面的

1 The MySQL administrator (root) has no password.

2 The MySQL daemon is accessible via network.

3 ProFTPD uses the password ”lampp” for user ”nobody”.

4 PhpMyAdmin is accessible via network.

5 Examples are accessible via network.

6 MySQL and Apache running under the same user (nobody).

如果要想修改默认设置密码,可以执行下面的命令

/opt/lampp/lampp security

再根据提示一步一步设置不同的密码就可以了。

下面详细说明一下 lampp 这个命令的各个参数的用法 :

start Starts XAMPP.
stop Stops XAMPP.
restart Stops and starts XAMPP.
startapache Starts only the Apache.
startssl Starts the Apache SSL support. This command activates the

SSL support permanently, e.g. if you restarts XAMPP in the

future SSL will stay activated.

startmysql Starts only the MySQL database.
startftp Starts the ProFTPD server. Via FTP you can upload files for

your web server (user ”nobody”, password ”lampp”). This

command activates the ProFTPD permanently, e.g. if you

restarts XAMPP in the future FTP will stay activated.

stopapache Stops the Apache.
stopssl Stops the Apache SSL support. This command deactivates

the SSL support permanently, e.g. if you restarts XAMPP

in the future SSL will stay deactivated.

stopmysql Stops the MySQL database.
stopftp Stops the ProFTPD server. This command deactivates the

ProFTPD permanently, e.g. if you restarts XAMPP in the

future FTP will stay deactivated.

security Starts a small security check programm.

下面写一个调用的例子:开启ssl服务

/opt/lampp/lampp startssl

还有,如果我们要手动配置它的Mysql,Apache,php,它们的目录和配置文件又在哪里呢?

/opt/lampp/bin/ The XAMPP commands home. /opt/lampp/bin/mysql calls for example the MySQL monitor.
/opt/lampp/htdocs/ The Apache DocumentRoot directory.
/opt/lampp/etc/httpd.conf The Apache configuration file.
/opt/lampp/etc/my.cnf The MySQL configuration file.
/opt/lampp/etc/php.ini The PHP configuration file.
/opt/lampp/etc/proftpd.conf The ProFTPD configuration file. (since 0.9.5)
/opt/lampp/phpmyadmin/config.inc.php The phpMyAdmin configuration file.

怎样停止服务呢?

/opt/lampp/lampp stop

怎样卸载服务呢?

先停止服务,再   rm -rf /opt/lampp

弟子规

弟子规

弟子规 圣人训 首孝弟 次谨信

泛爱众 而亲仁 有余力 则学文

来自 php培训讲师的人生感悟 http://www.skyleft.com/index.php/think-in-life/php-312.html

漂亮是女人的通行证

刚发现这话很有道理 ,把它转到博客上面来,好好体会下。

漂亮是女人的通行证。男人对于如花似玉的,明明知道最后也不见得赢得美人归,但还是愿意死心塌地讨好她。而那些缺乏视觉效果的女子尽管有的明明是良药,因为苦口,男人常常下不了决心娶她。

如何开启MySQL数据库远程连接

1、在控制台执行 mysql -u root -p mysql,系统提示输入数据库root用户的密码,输入完成后即进入mysql控制台,这个命令的第一个mysql是执行命令,第二个mysql是系统数据名称,不一样的。

2、在mysql控制台执行 GRANT ALL PRIVILEGES ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘MyPassword’ WITH GRANT OPTION;

3、在mysql控制台执行命令中的 ‘root’@'%’ 可以这样理解: root是用户名,%是主机名或IP地址,这里的%代表任意主机或IP地址,你也可替换成任意其它用户名或指定唯一的IP地址;’MyPassword’是给授权用户指定的登录数据库的密码;另外需要说明一点的是我这里的都是授权所有权限,可以指定部分权限,GRANT具体操作详情见:http://dev.mysql.com/doc/refman/5.1/en/grant.html

4、不放心的话可以在mysql控制台执行 select host, user from user; 检查一下用户表里的内容

北京php培训就去北京星模实训学校。学费低,就业快。

一个英文语句怎样把它的每个单词的字母顺序颠倒而单词顺序不变?_北京php培训

php面试题说明 :

例如:my name is fanglor  =》 ym eman si orlgnaf

php面试题的答案:

function restr ($str) 
{
	$str1 = explode (' ',$str);
	$str2 = '';
	$temp = '';
	for ($i=0;$i<count ($str1);$i++) 
	{
		$str2 .= $temp.strrev ($str1[$i]);
		$temp = ' ';
	}
	return $str2;
 
}

测试代码:

$str = "my name is fanglor ";
echo restr ($str);

打印结果:
ym eman si rolgnaf

百度招聘php研发工程师

刚收到php招聘信息,有找工作的同学,或者是周围有朋友找工作的同学请注意:
百度公司招聘如下工程师:
web前端研发工程师
数据挖掘工程师
PHP研发工程师
搜索技术研发工程师

据说待遇丰厚哦!像百度这样的大公司,这么好的php工作机会,感兴趣的兄弟们赶快投上你的简历吧。
转载请注明来自  http://www.skyleft.com/

一道求$b相对于$a的相对路径的php面试题

php面试题的题目:
$a = ‘/a/b/c/d/e.php’; $b = ‘/a/b/12/34/c.php’; //计算出 $b 相对于 $a 的相对路径应该是 ../../c/d

php面试题的答案:

function getRelative($a,$b) {
	$arr = explode("/",$a);
	$brr = explode("/",$b);
	$c = count($arr)-2;
	$d = count($brr)-2;
	//之所以减二,一个是不在后面的文件名,
        //一个是数组的索引是从0开始的,比数组中的第一维的个数要小一
	$e = ($c&gt;$d) ? $c:$d;
	$str1 = $str2 = '';
	for ($j=0;$j&lt;=$e;$j++) {
		$cur_a = isset($arr[$j]) ? $arr[$j] : '';
		$cur_b = isset($brr[$j]) ? $brr[$j] : '';
		if ($cur_a == $cur_b) {
			continue;
		} else {
			if ($j &lt;= $c)
			{
				$str1.='/'.$cur_a;
			}
			if ($j &lt;= $d )
			{
				$str2.="../";
			}
		}
	}
	return $str2.substr($str1,1,strlen($str1));
}

一道关于变量引用的php面试题

php面试题题目如下:

<?php
$a = 1;
$x =&$a;
$b=$a++;
?>

问:
$b和$x的值分别是什么?

php面试题的答案如下:
$b = 1;
$x = 2;

明白了吗? 没明白,再好好想想。 当一个变量等于另一个变量的引用的时候,这时任何一方改变了其值,另一方看到的这个值也会变化的。前加本次就表现出来,而后加下一次才会表现出来。

博客升级,部分数据丢失,如有发现友情链接不在了请留言。

昨天,把我的博客 wordpress升级 了一下,最近发现问题很多,以前的一些插件不能用了,还有就是留言评论什么的,当时是导出的xml,导进去之后才发现没有了。郁闷。 有情链接好像也不在里面,最后只能一个一个的加,难免有疏漏的地方,如果大家发现了,请给我留言,我好加上。

2010-07-27 星模实训fanglor