1. 基本安装

#yum install mysql-server httpd php php-mysql php-pdo php-gd php-pear php-dom php-mbstring

2. 开机启动mysql和Apache

#chkconfig httpd on
#chkconfig mysqld on

3. 配置mysql

#service mysqld start
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y                                            
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

4. 测试PHP, 创建/var/www/html/info.php


5. 配置虚拟主机
ServerAdmin zhouitpro@gmail.com
DocumentRoot /var/www/html/baifi.com
ServerName www.baifi.com
ServerAlias baifi.com

Drupal 忘记了密码了怎么办?

1. 修改密码

drush upwd --password="123" admin  //修改admin用户的密码为123

2. 创建登陆链接

drush user-login

这样会创建一个链接. 类似于
将user/reset/1/1396591957/zelsFiAgf-iOittnSLwaGTk16OWyJaIVSgsM5xEYDSI/login这段复制到你的网站主url后面. 然后打开这个URL自动登陆用户ID为1的用户



PHP Get Bash Path

function bash_path() {
  if(isset($_SERVER['REQUEST_URI'])) {
    // This request is either a clean URL, or 'index.php', or nonsense.
    // Extract the path from REQUEST_URI.
    $request_path = strtok($_SERVER['REQUEST_URI'], '?');
    $base_path_len = strlen(rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/'));
    // Unescape and strip $base_path prefix, leaving q without a leading slash.
    $path = substr(urldecode($request_path), $base_path_len + 1);
    // If the path equals the script filename, either because 'index.php' was
    // explicitly provided in the URL, or because the server added it to
    // $_SERVER['REQUEST_URI'] even when it wasn't provided in the URL (some
    // versions of Microsoft IIS do this), the front page should be served.
    if ($path == basename($_SERVER['PHP_SELF'])) {
      $path = '';
  else {
    // This is the front page.
    $path = '';
  return $path;