Apache2-SSL-PHP5-Howto (+ Zend Optimizer And IonCube Loader)
Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 04/11/2005
This document describes how to install an Apache web server (2.0.x) with SSL and PHP5 (with Zend Optimizer and ionCube Loader) enabled.
This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.
This document comes without warranty of any kind!
1 Get The Sources
We need the following software: openssl, apache (2.0.x), and PHP5. We will install the software from the /tmp directory.
cd /tmp
wget http://www.openssl.org/source/openssl-0.9.7g.tar.gz
wget http://ftp.plusline.de/ftp.apache.org/httpd/httpd-2.0.53.tar.gz
Then go to http://www.php.net and download the latest PHP version (5.0.4 at the time of this writing). Download it to your /tmp directory.
2 Install Openssl
tar xvfz openssl-0.9.7g.tar.gz
cd openssl-0.9.7g
./config
make
make install
3 Configure And Install Apache2
cd /tmp
tar xvfz httpd-2.0.53.tar.gz
cd httpd-2.0.53/
./configure --enable-ssl --with-ssl=/usr/local/ssl/ --enable-suexec --with-suexec-docroot=/usr/local --enable-cgi --enable-rewrite --enable-so --enable-logio --prefix=/usr/local/apache --enable-module=most --enable-shared=max --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc/httpd (1 line!)
Please note: You can change the configure command to suit to your needs. Type
./configure --help
to get a list of all configuration options available!)
make
make install
This will install Apache2 under /usr/local/apache. The web root directory is /usr/local/apache/htdocs, the log directory is /usr/local/apache/logs.
If we want to start up our Apache2 with SSL support we have to generate the file /etc/httpd/ssl.crt/server.crt because otherwise we will get an error message when we start Apache2.
mkdir /etc/httpd/ssl.crt
openssl genrsa -des3 -passout pass:asecretpassword -out /etc/httpd/ssl.crt/server.key.org 1024
openssl req -new -passin pass:asecretpassword -passout pass:asecretpassword -key /etc/httpd/ssl.crt/server.key.org -out /etc/httpd/ssl.crt/server.csr -days 3650
openssl req -x509 -passin pass:asecretpassword -passout pass:asecretpassword -key /etc/httpd/ssl.crt/server.key.org -in /etc/httpd/ssl.crt/server.csr -out /etc/httpd/ssl.crt/server.crt -days 3650
openssl rsa -passin pass:asecretpassword -in /etc/httpd/ssl.crt/server.key.org -out /etc/httpd/ssl.crt/server.key
mkdir /etc/httpd/ssl.key
mv /etc/httpd/ssl.crt/server.key /etc/httpd/ssl.key/server.key
chmod 400 /etc/httpd/ssl.key/server.key
(Please note: It is safe to accept the default values for all the questions you see when you create /etc/httpd/ssl.crt/server.crt because in either case you will receive a warning in your browser if you try to access an SSL site on your server:
If you do not want to get this warning you will have to get a "real" SSL certificate (but this is not for free!). Have a look at the following sites:
* http://www.instantssl.com/ (I would recommend this one.)
* http://www.verisign.com/
* http://www.thawte.com/
* http://www.baltimore.com/
* http://www.ipsca.com/
* http://www.entrust.com/
* http://www.geotrust.com/ )
4 Install PHP5
cd /tmp
tar xvfz php-5.0.4.tar.gz
./configure --with-apxs2=/usr/sbin/apxs --with-mysql=/var/lib/mysql --enable-track-vars --enable-sockets --with-config-file-path=/etc --enable-ftp --with-zlib --with-openssl=/usr/local/ssl --enable-force-cgi-redirect --enable-exif --with-gd --enable-memory-limit --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-trans-sid --enable-bcmath --with-bz2 --enable-ctype --with-db4 --with-iconv --enable-filepro --with-gettext --enable-mbstring --enable-shmop --enable-wddx --disable-xml --with-xmlrpc --enable-yp --with-zlib --without-pgsql --enable-dbx --enable-experimental-zts --without-mm --enable-gd-native-ttf --with-imap-ssl --enable-soap --enable-dbase (1 line!)
(Please note: You can change the configure command to suit to your needs. Type
./configure --help
to get a list of all configuration options available! In PHP5, you must specify the --with-mysql[=DIR] option, otherwise PHP5 will not have MySQL support! And yes, MySQL has to be installed before you run the ./configure statement. If you install MySQL From a package (.rpm or .deb), be sure that you also install the corresponding mysql-devel package! Otherwise the ./configure statement will abort with an error message.
If you use --with-gd, and you get an error message because of a missing libpng library, install it and then re-run the configure command. On Debian,
apt-get install libpng-dev libpng2 libpng2-dev libpng3
worked fine for me to install libpng. If you have an rpm-based distribution, use http://www.rpmfind.net to find an rpm for you, or have a look at http://www.libpng.org/pub/png/libpng.html.)
make
make install
This will install a PHP binary (normally under /usr/local/bin/php) that can be run from the command line as well as an Apache module.
Now we have to create /etc/php.ini. The easiest way is to take the one that comes with the PHP sources:
cp /tmp/php-5.0.4/php.ini-dist /etc/php.ini
If you like you can now modify /etc/php.ini to suit to your needs.
5 Configure Apache
Now we have to add the following entries in /etc/httpd/httpd.conf (in the section where document types are handled; there should be entries like AddHandler or AddType):
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddType application/x-httpd-php .php .php5 .php4 .php3
Create /etc/init.d/httpd:
#!/bin/sh
case "$1" in
start)
/usr/sbin/apachectl startssl
;;
stop)
/usr/sbin/apachectl stop
;;
restart)
$0 stop && sleep 3
$0 start
;;
reload)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
chmod 755 /etc/init.d/httpd
In order to start your Apache at boot time do the following:
ln -s /etc/init.d/httpd /etc/rc2.d/S20httpd
ln -s /etc/init.d/httpd /etc/rc3.d/S20httpd
ln -s /etc/init.d/httpd /etc/rc4.d/S20httpd
ln -s /etc/init.d/httpd /etc/rc5.d/S20httpd
ln -s /etc/init.d/httpd /etc/rc0.d/K20httpd
ln -s /etc/init.d/httpd /etc/rc1.d/K20httpd
ln -s /etc/init.d/httpd /etc/rc6.d/K20httpd
Then start your Apache:
/etc/init.d/httpd start
6 Test Your Configuration
netstat -tap
should show you that Apache2 uses the ports 80 (http) and 443 (https).
Now go to /usr/local/apache/htdocs and create a file called info.php with the following contents:
<?php
phpinfo();
php?>
Try to access it with your browser (e.g. using the IP address of the server) via http (e.g. http://192.168.0.1/info.php) and https (https://192.168.0.1/info.php). The output should look similar to this screenshot:
7 Install Zend Optimizer And IonCube Loader
If you want to run PHP files that have been encoded with the Zend Encoder you need the Zend Optimizer. If you want to run PHP files that have been encoded with the ionCube PHP Encoder you need the ionCube Loader. I will show how to install both.
IonCube Loader
Get the latest version of the ionCube Loader from http://downloads.ioncube.com/loader_downloads.
cd /tmp/
wget http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar xvfz ioncube_loaders_lin_x86.tar.gz
cd ioncube/
mkdir /usr/local/lib/ioncube
mv ioncube_loader_lin_5.0.so /usr/local/lib/ioncube/
Now edit /etc/php.ini and add the line zend_extension=/usr/local/lib/ioncube/ioncube_loader_lin_5.0.so right at the beginning:
[PHP]
zend_extension=/usr/local/lib/ioncube/ioncube_loader_lin_5.0.so
Zend Optimizer
Get the latest version of the Zend Optimizer from http://www.zend.com/store/free_download.php and save it in your /tmp/ directory.
cd /tmp/
tar xvfz ZendOptimizer-2.5.7-linux-glibc21-i386.tar.gz
cd ZendOptimizer-2.5.7-linux-glibc21-i386/data/5_0_x_comp/
mkdir /usr/local/lib/Zend
mv ZendOptimizer.so /usr/local/lib/Zend/
Edit /etc/php.ini and add two more lines to the [PHP] section of the file at the beginning so that it looks like this:
[PHP]
zend_extension=/usr/local/lib/ioncube/ioncube_loader_lin_5.0.so
zend_extension=/usr/local/lib/Zend/ZendOptimizer.so
zend_optimizer.optimization_level=15
Now restart Apache2:
/etc/init.d/httpd restart
If you reload your info.php that you created in step 6 you should now see that the ionCobe Loader and the Zend Optimizer are mentioned on the page:
Links
Apache: http://www.apache.org/
OpenSSL: http://www.openssl.org/
PHP: http://www.php.net/
Zend: http://www.zend.com/
ionCube: http://www.ioncube.com/
Original location of this document: http://www.falkotimme.com/howtos/apache2_ssl_php5_zendoptimizer_ioncubeloader/
分享到:
相关推荐
Zend Optimizer能够优化PHP代码,提高其执行效率,而Zend Loader则用于执行 Zend Guard 加密的PHP代码,保护源代码不被轻易查看或篡改。 在提供的压缩包文件中,`manual.chm`可能是该工具包的用户手册,包含了详细...
Apache_PHP+MySQL+phpMyAdmin+ZendOptimizer
### Windows XP + Apache 2.2.4 + PHP 5.2.0 + MySQL 5.0.27 + Zend Optimizer 3.2.0环境配置方法 #### Apache 2.2.4 的安装与配置 Apache 作为一款开源且功能强大的Web服务器软件,在Windows XP上安装和配置相对...
本教程将详细讲解如何在Windows操作系统上,使用IIS6作为Web服务器,PHP5作为脚本解释器,MySQL5作为数据库管理系统,以及ZendOptimizer3.3.0作为PHP性能优化工具进行安装与配置。这些组件的结合,能够支持动态网站...
标题 "Apache2.2.14 + MySql5.1.41 + PHP5.3.1 + PhpMyAdmin3.2.4 + ZendOptimizer 3.3.0配置" 描述了一个集成的Web开发环境,这个环境包含了多个关键组件,用于搭建PHP驱动的Web应用程序。以下是对这些组件的详细...
本文档主要介绍了如何在Windows Server 2003 R2 Enterprise Edition SP2 x86系统上配置一个基于IIS6的PHP服务器环境,包括PHP、MySQL、Zend Optimizer和phpMyAdmin的安装与配置。以下是详细步骤: 1. **PHP的安装与...
这个是安装说明文件,里面要用的安装文件,除了MYSQL 5。0太大,不能上传,其他的都上传了!!安装文件免费共享了,想快速安装成功的兄弟,请下载这个说明文件,我要收3分哦!我也想去下别人的好东西!!呵呵!
《phpStudyV1.75:一站式集成安装Apache、PHP、MySQL与ZendOptimizer》 在IT行业中,Web开发是至关重要的领域,而PHP作为一种流行的服务器端脚本语言,广泛应用于网站构建。为了简化PHP开发环境的搭建过程,...
PHP 环境配置 PHP5+MySQL5+Apache2+phpMyAdmin+ZendOptimizer 安装与配置 PHP 环境配置是指将 PHP、MySQL、Apache、phpMyAdmin 和 ZendOptimizer 等组件安装和配置到一起,以便创建一个完整的 PHP 开发环境。以下是...
然而,需要注意的是,Zend Optimizer不兼容PHP 5.3及以上版本,因此对于升级PHP版本的计划,这个组件必须被替换为其他兼容的解决方案,如Zend Guard Loader或OpCache。 【与IIS7的集成】 IIS(Internet ...
替换"C:\path\to\zend_optimizer.dll"为实际的Zend_Optimizer DLL文件路径。 3. **验证安装**: 创建一个php文件,如phpinfo.php,包含`<?php phpinfo(); ?>`,通过浏览器访问,查看输出信息确认Zend_Optimizer是否...
xampp+ZendOptimizer软件组合,彻底解决乱码问题 安装方法: ...2 安装ZendOptimizer(根据提示,选择php和apache相应的目录) 3修改php.ini文件(zend_optimizer.enable_loader = 1,注意,这里要改为1)
"IIS+PHP+MySQL+Zend Optimizer+GD 库+phpMyAdmin 安装配置" 本文将详细介绍 IIS、PHP、MySQL、Zend Optimizer、GD 库和 phpMyAdmin 的安装配置过程。 一、软件准备 在开始安装之前,请确保已经安装了 Windows ...
php环境配置 php5 MySQL5 apache2 phpmyadmin ZendOptimizer安装与配置 - php基础编程绝佳的入门教程!
请注意,由于ZendOptimizer不支持PHP5.3.x,因此如果需要使用更高版本的PHP,需寻找其他兼容的加速器,例如ionCube Loader或OPcache。此外,对于新的PHP版本,应遵循类似的配置步骤,但可能需要更新特定扩展和配置...
按照本教程安装设置后将保证你能够...论坛程序以及Mysql数据库管理程序phpmyadmin,目前本文是Win2003+IIS6.0+MySql 5.0.37+PHP 5.2.1+ZendOptimizer 3.2.6+phpMyAdmin 2.10.0.2环境配置最全面的教程文章,值得收藏。
集成最新的Apache+PHP+MySQL+ZendOptimizer,一次性安装,无须配置即可使用,是非常方便、好用的PHP调试环境。该程序不仅包括PHP调试环境,还包括了开发工具、开发手册以及一些高级应用等。总之学习PHP只需一个包. ...