分类 技术分享 下的文章

共将创建3个文件,header.php为网页头部,index.php为主体内容,footer.php为底部。

header.php文件内容

<html>
<head>
<title>PHP的require()函数</title>
<style>
p{font-size:24px;color:#FF0000;}
</style>
</head>
<body>

footer.php文件内容

</body>
</html>

index.php主体文件内容

<?php require('header.php'); ?>
<p>Here is the content for this page</p>
<?php require('footer.php'); ?>

浏览器输出内容

<html>
<head>
<title>PHP的require()函数</title>
<style>
p{font-size:24px;color:#FF0000;}
</style>
</head>
<body><p>Here is the content for this page</p>
</body>
</html>

<?php
$pictures = array('1.jpg','2.jpg','3.jpg','4.jpg','5.jpg','6.jpg','7.jpg','8.jpg','9.jpg','10.jpg','11.jpg','12.jpg');
shuffle($pictures);
?>
<html>
<head>
	<title>Bob's Auto Parts</title>
</head>
<body>

<h1>Bob's Auto Parts</h1>
<div align="center">
<table width=100%>
<tr>
<?php
for ($i=0;$i<3;$i++){
	echo "<td align=\"center\"><img src=\"";
	echo $pictures[$i];
	echo "\"></td>";
	}
?>
</tr>
</table>
</div>
</body>
</html>

错误

Stopping httpd:                                            [  OK  ]
Starting httpd: [Wed Oct 09 22:52:30 2013] [error] VirtualHost 110.110.110.110:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
[Wed Oct 09 22:52:30 2013] [error] VirtualHost 110.110.110.110:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

解决办法

vi /etc/httpd/conf/extra/httpd-vhosts.conf
修改错误后保存重启Apache

示例

NameVirtualHost *:80
NameVirtualHost *

<VirtualHost *:80>
DocumentRoot /var/www
ServerName www.example.com
...
</VirtualHost>

<VirtualHost *>
DocumentRoot /var/www
ServerName www.example.org
...
</VirtualHost>

1、先联系DA官方更换IP,就是重新颁发许可证。

2、启动服务器。并在网络中分配该IP地址,这个一般都分配了的。。

3、如果第一步已经做过了,并且成功颁发了。执行下面的操作更新下。

cd /usr/local/directadmin/scripts 
./getLicense.sh 1234 56789

1234是客户编号,56789是许可证编号。

4、然后重启DA

/etc/init.d/directadmin restart

5、使用下面的脚本批量更换IP

cd /usr/local/directadmin/scripts   
./ipswap.sh 1.2.3.4 4.3.2.1

前面是老的IP,后面是新的IP。

6、重启服务

/etc/init.d/httpd restart 
/etc/init.d/proftpd restart 
/etc/init.d/exim restart 
/etc/init.d/dovecot restart

官方wiki http://help.directadmin.com/item.php?id=250
参考:http://lanbing.org/dachangeip.cgi

最近事儿比较多,没什么时间写博客,也不怎么想写。重要的日记都写在纸上了,不重要的又不想浪费时间发表在博客上。都知道国内CDN加速是要备案的,对我们这些国外的空间来说没什么用。七牛云存储可以为静态文件加速,而且有WP的插件很方便就可以完成部署。静态文件指的是JS、CSS、图片等,不仅可以节省流量,而且可以给网站提高速度,如果是图片比较多的网站效果明显!下面是我的博客使用后效果

qiniu

- 阅读剩余部分 -

刚安装完DirectAdmin发现phpmyadmin 500错误,/var/www/html里面的PHP文件访问都是500错误,执行以下命令可解决。

cd /usr/local/directadmin/custombuild/
./build update
./build apache
./build rewrite_confs
service httpd restart