Tag Archives: PHP
php-fpm 修改php-cgi进程数
Posted on 28. Jan, 2010 by Yao Yuan.
vi /usr/local/php/etc/php-fpm.conf
修改这个里面的值
然后
/usr/local/php/sbin/php-fpm restart
Continue Reading
导入大数据库的方法
Posted on 08. Nov, 2009 by Yao Yuan.
phpmyadmin是个很方便的mysql数据库管理工具,可以用来管理mysql数据库,导入,导出等。
phpmyadmin在导入mysql的时候有个问题,如果要导入的数据库文件比较大,那么导入就会失败。下面介绍一个方法,可以导入任意大小的mysql数据库,步骤如下:
1. 通过FTP把数据库的SQL文件上传到网站的根目录下
2. 在网站的根目录下,创建文件import.php,该文件的内容见文章末尾
3. 在浏览器里面访问这个import.php,假设你的网站域名是www.a.com,那么就在浏览器里面访问 http://www.a.com/import.php , 只要浏览器一开始访问这个import.php文件,数据就开始导入了
4. 数据导入结束后,屏幕上会出现”import ok”的字样
import.php文件的内容如下:
< ?
system("mysql -uroot -pmypassword database < a.sql");
print "import ok";
?>
其中root表示数据库用户名,mypassword表示root的密码,database表示要导入的数据库的名字,a.sql表示数据库文件的文件名,该文件是解压缩后的文件。这几个变量可以根据实际情况修改。
Continue Reading
Execute PHP in WordPress post, page and Widget Sidebar
Posted on 06. Mar, 2009 by Yao Yuan.

If you are still struggling on how to insert PHP Codes inside particular blog post, page or a widget sidebar for execution; the following tutorial is for you.
Executing PHP codes in WordPress Page/Post
Installation
- Download phpexec.txt
- Rename phpexec.txt to phpexec.php
- Upload to /wp-content/plugins/ directory
- Activate the plug-in from WordPress administration menu
Usage
Anywhere in your post/pages where you want to execute a PHP Codes, insert <phpcode> before your php codes and </phpcode> your php codes.
<phpcode>
<?php
echo "Current date and time: ";
echo date("l dS of F Y h:i:s A");
?>
</phpcode>
Security
If you are running a blog with multiple users, you need to determine who can run this plug-in. Alter the settings in your Administration Menu. Options -> PHPExec
Executing PHP codes in WordPress widget sidebar
Installation
- Download execphp.txt
- Rename execphp.txt to execphp.php
- Upload to /wp-content/plugins/ directory
- Activate the plug-in from WordPress administration menu
Usage
This plug-in work like a normal text widget except that it allows execution of PHP Codes. You can create up to 9 instances of this widget. 
Continue Reading
Variable transmission Between two pages in php
Posted on 15. Feb, 2009 by Yao Yuan.
在网站设计中,我们常常用到用户登陆这一方法,在登陆后,一般的网站都会根据不同的用户来给定不同的页面,在链接到该站的一个新的网页或者打开一张新网页时,我们也会看到用户的信息能够被记住,现在尤其常用的是,登陆后链接或打开该站的其它网页都会看到诸如”XXX,晚上好”之类的问候语,这些当然都是在登陆后变量传送的结果,在我做个人主页的过程中,曾尝试几种变量传送的方法,现写出来与大家探讨一下。 [...]
Continue Reading
superglobals variable
Posted on 15. Feb, 2009 by Yao Yuan.
In PHP 4.2.0 and later, the default value for the PHP directive register_globals is off. This is a major change in PHP. Having register_globals off affects the set of predefined variables available in the global scope. For example, to get DOCUMENT_ROOT you’ll use $_SERVER['DOCUMENT_ROOT'] instead of $DOCUMENT_ROOT, or $_GET['id'] from the URL http://www.example.com/test.php?id=3 instead of $id, or $_ENV['HOME'] instead of $HOME.
For related information on this change, read the configuration entry for register_globals, the security chapter on Using Register Globals , as well as the PHP » 4.1.0 and » 4.2.0 Release Announcements.
Using the available PHP Reserved Predefined Variables, like the superglobal arrays, is preferred [...]
Continue Reading
variable variable, PHP and you
Posted on 14. Feb, 2009 by Yao Yuan.
什么叫作变量的变量?根据PHP手册,变量的变量是指取得一个变量的值并把它作为另一个变量的变量名。这表述显得相当的直接,容易和那些在一个句子中使用 “变量”这个词弄混淆。给一个简单的例子,你定义一个变量 — x 等于 this — 然后定义一个变量的变量,意味着你把 x 的值作为新变量的名,在这个例子中,这个新变量的值是 is cake。用PHP来表示如下: [...]
Continue Reading
The use of varible in PHP
Posted on 14. Feb, 2009 by Yao Yuan.
就像大部份的结构化程序,有所谓的全局变量与局部变量,php 在这方面也是有相同的处理方式。 [...]
Continue Reading
Variable type of php
Posted on 14. Feb, 2009 by Yao Yuan.
php 的变量类型不多,有以下五种:
- string
- integer
- double
- array
- object
Continue Reading
PHP learning plan….
Posted on 13. Feb, 2009 by Yao Yuan.
step by step, PHP is easy
http://docs.php.net/manual/zh/
http://www.phpchina.com/study/23/phpstudy.html




