最後更新: 2022-06-06
目錄
Check verion
<? echo phpversion() ?>
New Line
# PHP_EOL: system-dependent constant
echo "this is my text" . PHP_EOL;
不 Display version
/etc/php.ini
# X-Powered-By header expose_php = Off
timezone
php5.3.3
PHP Warning: date(): It is not safe to rely on the system's timezone settings.
php.ini 找到
[Date] ;date.timezone = Asia/Hong_Kong
ftp_connect
在 php5.3.3, ftp_connect 的 $host 不可以直接 "locahost"
$conn_id = @ftp_connect($host, $port);
mkdir 的 permission 不能 777
<?php mkdir("/var/www/xxx/web/tim_test", 0700); ?>
mode
The mode is 0777 by default, which means the widest possible access.
For more information on modes, read the details on the chmod() page.
Note that you probably want to specify the mode as an octal number, which means it should have a leading zero. The mode is also modified by the current umask, which you can change using umask().
code
<?php $oldumask = umask(0); mkdir('mydir', 0777); // or even 01777 so you get the sticky bit set umask($oldumask); ?>
persistent-connections
* PHP as a module 可用到 !!
Persistent connections are links:
<1> do not close when the execution of your script ends
<2> When a persistent connection is requested,
PHP checks if there's already an identical persistent connection and if it exists, it uses it.
注意:
* locking
* transaction
One is that when using table locking on a persistent connection,
if the script for whatever reason cannot release the lock,
then subsequent scripts using the same connection will block indefinitely and
may require that you either restart the httpd server or the database server.
a transaction block will also carry over to the next script which
uses that connection if script execution ends before the transaction block does.
多個 php 造 webpage
在多段的 php 內, 所中一段行唔到 (error)
那生成的 php 只會有一半. 那有可能會令部分 js include 唔到.
i.e.
header, body, footer
MySettings
/etc/php.ini
memory_limit = 256M max_execution_time = 30 max_input_time = 60 short_open_tag = On expose_php = Off upload_max_filesize = 20M post_max_size = 28M session.gc_maxlifetime = 3600 date.timezone = Asia/Hong_Kong