首页 > 编程技术 > php

Compilingphpwithcrypt()

发布时间:2016-11-25 16:33

Compiling php with crypt()
author:
Daniel Beulshausen
updated:
14.10.2000


This quick tutorial shall help you to compile php with support for the crypt() function, because it's not correct that if you use windows you can't use crypt().
It is however correct that libcrypt isn't available by default on windows, but you can use the libary from our download section.
Extract the zip and move crypt.h to your include folder, and the needed libary (release or debug) to your libary folder (tools -> options -> folders).
Load the php workspace, and add crypt.c (can be found in ext/standard/) to the php4dllts group (you can put crypt.c to Function Modules -> Source Files).
Now edit the link options of the php4dllts project, and add libcrypt to the link libaries, note that we compiled a release and a debug libary, please use only release for the release builds, and the debug libary for debug builds!
Now edit config.w32.h (located in main/), edit it and change the needed defines:
#define HAVE_CRYPT 1
#define HAVE_CRYPT_H 1
This should do the trick, and it'll build you php with the crypt() function. 
JAVA是个非常强大的编程利器,它的扩展库也是非常的有用,这篇教程,主要讲述怎样使用PHP调用功能强大的JAVA 类库(classes)。为了方便你的学习,这篇教程将包括JAVA的安装及一些基本的例子。
windows下的安装
第一步:安装JDK,这是非常容易的,你只需一路回车的安装好。然后做好以下步骤。
在 Win9x 下加入 :“PATH=%PATH%;C:jdk1.2.2in” 到AUTOEXEC.BAT文件中
在 NT 下加入 “;C:jdk1.2.2in”到环境变量中。
这一步是非常重要的,这样PHP才能正确的找到需调用的JAVA类。
第二步:修改你的PHP.INI文件。
[java]
extension=php_java.dll
java.library.path=c:webphp4extensions
java.class.path="c:webphp4extensionsjdk1.2.2php_java.jar;c:myclasses"
在PHP.INI中加入extension=php_java.dll
并在[java]中,设定好java.class.path,让它指向php_java.jar,如果你使用新的JAVA类,你也应该存入这个路径,在这篇例子中,我们使用c:myclasses这个目录。
第三步:测试环境,创建如下PHP文件:

$system = new Java("java.lang.System");
print "Java version=".$system->getProperty("java.version")."
";
print "Java vendor=".$system->getProperty("java.vendor")."
";
print "OS=".$system->getProperty("os.name")." ".
$system->getProperty("os.version")." on ".
$system->getProperty("os.arch")."
";
$formatter = new Java("java.text.SimpleDateFormat","EEEE,
MMMM dd, yyyy 'at' h:mm:ss a zzzz");
print $formatter->format(new Java("java.util.Date"))." ";
?>
如果你正确安装了,你将会看到以下信息:
Java version=1.2.2
Java vendor=Sun Microsystems Inc.
OS=Windows 95 4.10 on x86
Wednesday, October 18, 2000 at 10:22:45 AM China Standard Time
这样,我们就已经成功的建立起了可以使用JAVA类的PHP运行环境,我们可以开始我们接下去的课程了。
作者:井中月
转载:
read_exif_data
(PHP 4 )
read_exif_data -- Reads header information stored in TIFF and JPEG images
Description
array exif_read_data ( string filename, string sections, bool arrays, bool thumbnail)
Note: The read_exif_data() function is an alias for exif_read_data().
See also exif_thumbnail().
User Contributed Notes
read_exif_data
inq@inq.dhs.org
03-Jan-2001 03:52
Each of my jpeg files are over 1 meg, and read_exif_data seems to read the
whole file and it's very slow. So I wrote a function to read only the
beginning of each file:
function read_exif_data_quick($path) {
$tmpfile = "/tmp/read_exif_data_quick.tmp_file";
$in = fopen($path, "r");
$out = fopen($tmpfile,"w");
fwrite( $out, fread( $in, 15000 ) );
fclose($in);
fclose($out);
return read_exif_data($tmpfile);
}
And so far it works for all of my jpegs (taken with my digital camera).
garbage@sunflowerroad.com
06-Jul-2001 05:33
I started drooling when I saw that php could read the exif information
automatically for me. Then I found out that read_exif_data is NOT
compiled into the standard win32 build (think about including it please!).
To get around this I found the following program that runs from the
command line and works really well.
it's actually a set of utilities that will even allow you to put exif data
into images.
It's freeware, but the license says no commercial use without written
permission.
http://www.users.bigpond.com/hughthomas/exif.html
garbage@sunflowerroad.com
06-Jul-2001 05:34
By the way, it works under linux or win32
ibaldin@anr.mcnc.org
21-Aug-2001 11:43
Perl Image::Info module is capable of reading EXIF tags (places them into
an associative array). You can write a simple script to use the module and
it will extract all or only required tags out of a jpeg file.
作 者: 徐永久
我们知道 Zend 有免费的优化引擎针对 PHP 而作,但是 FreeLAMP 这次采用的是一个叫做 PHP Accelerator 的缓冲产品。
我们在 “LAMP 加速” 这篇文章中阐述过加速的几种办法,其中提到了 PHP Accelerator,它的安装方法十分简单,但是需要去他的网站获取一个激活键。
一、下载:
http://www.php-accelerator.co.uk/download.php
二、获取激活键并安装:
http://www.php-accelerator.co.uk/activate.php
注册自己的 SERVER_NAME 后,你会得到下面的提示:
Your key for www.freelamp.com is 8edfd13946c96309244fcca309415902
Now you must set the key for www.freelamp.com in your site configuration.
For single domains not using virtual hosts
The key can be set in the php.ini file as follows:
# PHPA key for www.freelamp.com
#
phpa.registration_key = 8edfd13946c96309244fcca309415902
For domains setup as a virtual host
Add the key to the domain specific section for your web server.
# www.freelamp.com VHost entry
#
ServerName www.freelamp.com
# ... (other vhost specific config)
# php settings
php_value phpa.registration_key 8edfd13946c96309244fcca309415902
# also enable phpa if set to off in the php.ini (the default is on)
php_value phpa 1
具体的 phpa 值的设置,可以参考软件随带的 CONFIGURATION 文件的配置。
由于大多数网站是虚拟主机配置,所以,建议采用 php_value phpa. 的方式设置。
例如:
php_value phpa.tweaks off
php_value phpa.cache_dir /tmp
php_value phpa.file_perms 400
php_value phpa.ignore_files "/index.php, /a/test.php"
# php_value phpa.ignore_dirs "/data/WWW/site1/,/cache/"
php_value phpa.shm_size 8
php_value phpa.shm_key 0xc0deb00
php_value phpa.shm_perms 664
三、设置 php.ini
假设我们把下载后的文件解开到 /usr/local/php ,那么在 php.ini 中加入:
zend_extension=/usr/local/php/php_accelerator_1.2p2.so
并注释掉原来的 Zend 优化引擎:
# zend_extension=/usr/local/Zend/lib/ZendOptimizer.so
最近在用PHP作一社区, 在写到计算最高上线人数时, 成功调试出把PHP作为shell script直接在服务器上运行.
在作社区时, 时常需要统计上线人数等数据. 一般做法是, 把这段代码放在用户login或者某一个页面中, 以便在用户登录或访问到该时,触发运行该代码. 这样一来, 会造成一个问题, 如果该代码教复杂, 明显减慢该页的正常调用速度.
利用PHP 的这种特性,加上linux的crontab指令,即可自动定时执行某一个php文件(统计在线人数等).
具体方法:
在安装PHP的时候,会产生一个可执行文件,文件名为php.将它它 copy 到 /usr/local/bin 下.
在终端方式执行php程序: php -q onlinnum.php<Enter>
注意到 PHP 原本是应用在网页应用的╋因此它内定会送出 HTML 的 HEADER╋但是在此我们是要将 PHP 用作 Shell Script╋"-q" 就是表示不要送出 HEADER 的意思.你可以试试看不加上 -q 的显示结果。
此时你已经可以在终端方式下执行PHP 代码了. 呵呵,可以试试执行你以前写的代码.
linux命令:cron daemon
这是一个系统中常驻的服务,功能在于执行例行性的工作,如每天一次或每月一次检查磁盘。cron daemon 会在每分钟检查一次排定的工作表(crontab),看看是否有要执行的指令,所有的输出会以mail寄给用户。
设置 crontab
命令:crontab -e<Enter>
该命令呼叫vi编辑器来编辑执行的清单。例如
            0 0 1,15 * * fsck /home
            1 * * * * /home/Gull/onlinnumber
每一行代表一项排定的工作,在指令前为排定的时间,总共有5个栏位,以空格间隔,由左到右依序如下:
       栏位        说明
        --------------------------
       分钟       从00到99
       点钟       从0到24
       日       从01到31
       月       从01到12
标签:[!--infotagslink--]

您可能感兴趣的文章: