Configuration PHP5.4 oci8 MySQL5.5 on CentOS6 x86_64
来源:互联网 发布:淘宝宠物 编辑:程序博客网 时间:2024/06/06 19:46
Software Package
apr-1.4.6.tar.gz
apr-util-1.5.1.tar.gz
httpd-2.4.6.tar.gz
libiconv-1.13.1.tar.gz
libmcrypt-2.5.8.tar.gz
mcrypt-2.6.8.tar.gz
mhash-0.9.9.9.tar.gz
mysql-5.5.25.tar.gz
oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64.rpm
pcre-8.31.tar.gz
php-5.4.17.tar.gz
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel ssse2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gettext-devel libXpm-devel libtool libevent libevent-devel gd-devel gd libmcrypt libmcrypt-devel pcre pcre-devel
installation apr
[root@lamop software]# tar -zxvf apr-1.4.6.tar.gz > /dev/null [root@lamop software]# cd apr-1.4.6[root@lamop apr-1.4.6]# ./configure --prefix=/service/apr[root@lamop apr-1.4.6]# make && make install
[root@lamop software]# tar -zxvf apr-util-1.5.1.tar.gz >/dev/null [root@lamop software]# cd apr-util-1.5.1[root@lamop apr-util-1.5.1]# ./configure --prefix=/service/apr-util --with-apr=/service/apr[root@lamop apr-util-1.5.1]# make && make install
installation apache
[root@lamop software]# tar -zxvf httpd-2.4.6.tar.gz > /dev/null [root@lamop software]# cd httpd-2.4.6[root@lamop httpd-2.4.6]# ./configure --prefix=/service/apache --enable-dav --enable-so --enable-maintainer-mode --with-apr=/service/apr --with-apr-util=/service/apr-util[root@lamop httpd-2.4.6]# make && make install
installation MySQL5.5
[root@lamop software]# tar -zxvf mysql-5.5.25.tar.gz > /dev/null[root@lamop software]# cd mysql-5.5.25[root@lamop mysql-5.5.25]# cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/service/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=30306 -DCOMPILATION_COMMENT=ZWC -DWITH_DEBUG=0[root@lamop mysql-5.5.25]# make && make install[root@lamop mysql-5.5.25]# cat /service/mysql/my.cnf [client] port = 30306socket = /data/mysql/mysql.sock [mysqld] port = 30306socket = /data/mysql/mysql.sock skip-external-locking back_log = 500 lower_case_table_names = 1 skip-name-resolve max_connections = 1024 table_open_cache = 512 binlog_cache_size = 1M max_heap_table_size = 300M read_buffer_size = 10M read_rnd_buffer_size = 16M sort_buffer_size = 8M join_buffer_size=4M thread_cache_size = 4 thread_concurrency = 4 query_cache_size = 200M ft_min_word_len = 4 thread_stack = 192K tmp_table_size = 200M slow_query_log long_query_time = 2 slow_query_log_file = /data/mysql/slowsql.sql key_buffer_size = 32M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 200M myisam_repair_threads = 4 myisam_recover # setup innodb innodb_additional_mem_pool_size = 16M innodb_buffer_pool_size = 2500M innodb_data_file_path = ibdata1:10M:autoextend innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_thread_concurrency = 16 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 8M innodb_log_file_size = 512M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 init_connect = 'SET autocommit=0' innodb-file-per-table = 1 innodb-open-file = 500 innodb_flush_method=O_DIRECT expire_logs_days = 5 federated event_scheduler = 1 log-bin=ZWC-TEST binlog_format=mixed server-id = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] prompt=\\u@\\d \\r:\\m:\\s> no-auto-rehash [myisamchk] key_buffer_size = 128M sort_buffer_size = 128M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout
[root@lamop mysql-5.5.25]# /service/mysql/scripts/mysql_install_db --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysqlInstalling MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/service/mysql/bin/mysqladmin -u root password 'new-password'/service/mysql/bin/mysqladmin -u root -h 192.168.1.10 password 'new-password'Alternatively you can run:/service/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /service/mysql ; /service/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /service/mysql/mysql-test ; perl mysql-test-run.plPlease report any problems with the /service/mysql/scripts/mysqlbug script![root@lamop mysql-5.5.25]# /service/mysql/bin/mysqld_safe --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql &[1] 13675[root@lamop mysql-5.5.25]# 131113 20:19:51 mysqld_safe Logging to '/data/mysql/lamop.err'.131113 20:19:51 mysqld_safe Starting mysqld daemon with databases from /data/mysql
[root@lamop mysql-5.5.25]# /service/mysql/bin/mysqladmin -uroot passwordNew password: Confirm new password: [root@lamop mysql-5.5.25]# /service/mysql/bin/mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.5.25-log ZWCCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.root@(none) 08:21:46>delete from mysql.user where password=''; Query OK, 5 rows affected (0.00 sec)root@(none) 08:21:59>delete from mysql.db where user='';Query OK, 2 rows affected (0.00 sec)root@(none) 08:22:07>select @@version;+------------+| @@version |+------------+| 5.5.25-log |+------------+1 row in set (0.00 sec)root@(none) 08:22:11>
installation libmcrypt
[root@lamop software]# tar -zxvf libmcrypt-2.5.8.tar.gz > /dev/null [root@lamop software]# cd libmcrypt-2.5.8[root@lamop libmcrypt-2.5.8]# ./configure [root@lamop libmcrypt-2.5.8]# make && make install[root@lamop libmcrypt-2.5.8]# /sbin/ldconfig [root@lamop libmcrypt-2.5.8]# cd libltdl/[root@lamop libltdl]# ./configure --enable-ltdl-install[root@lamop libltdl]# make && make install
installation mhash
[root@lamop software]# tar -zxvf mhash-0.9.9.9.tar.gz > /dev/null [root@lamop software]# cd mhash-0.9.9.9[root@lamop mhash-0.9.9.9]# ./configure[root@lamop mhash-0.9.9.9]# make && make install[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2[root@lamop mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1[root@lamop mhash-0.9.9.9]# ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
installation mcrypt
[root@lamop software]# tar -zxvf mcrypt-2.6.8.tar.gz > /dev/null [root@lamop software]# cd mcrypt-2.6.8[root@lamop mcrypt-2.6.8]# /sbin/ldconfig [root@lamop mcrypt-2.6.8]# ./configure [root@lamop mcrypt-2.6.8]# make && make install
installation pcre
[root@lamop software]# tar -zxvf pcre-8.31.tar.gz > /dev/null [root@lamop software]# cd pcre-8.31[root@lamop pcre-8.31]# ./configure --prefix=/service/pcre[root@lamop pcre-8.31]# make && make install
installation libiconv
[root@lamop software]# tar -zxvf libiconv-1.13.1.tar.gz > /dev/null [root@lamop software]# cd libiconv-1.13.1[root@lamop libiconv-1.13.1]# ./configure --prefix=/service/libiconv[root@lamop libiconv-1.13.1]# make && make install
installation and configuration PHP5.4
[root@lamop software]# tar -zxvf php-5.4.17.tar.gz > /dev/null [root@lamop software]# cd php-5.4.17[root@lamop php-5.4.17]# ./configure --prefix=/service/php --with-apxs2=/service/apache/bin/apxs --with-mysql=/service/mysql --with-ttf --with-xmlrpc --with-openssl --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv=/service/libiconv --enable-short-tags --enable-sockets --enable-zend-multibyte --enable-soap --enable-mbstring --enable-static --enable-gd-native-ttf --with-curl --with-mcrypt[root@lamop php-5.4.17]# make && make install[root@lamop php-5.4.17]# cp php.ini-production /service/php/lib/php.ini[root@lamop php-5.4.17]# chown -R apache.apache /service/apache/htdocs[root@lamop php-5.4.17]# chmod -R 700 /service/apache/htdocsEdit "/service/apache/conf/httpd.conf"
Add the following content under "LoadModule php5_module modules/libphp5.so"
AddType application/x-httpd-php .php
installation and configuration pdo_oci,oci8,oracleClient on PHP5.4
[root@lamop software]# rpm -Uvh *.rpmPreparing... ########################################### [100%] 1:oracle-instantclient11.########################################### [ 33%] 2:oracle-instantclient11.########################################### [ 67%] 3:oracle-instantclient11.########################################### [100%][root@lamop software]# rpm -qa|grep oracleoracle-instantclient11.1-sqlplus-11.1.0.7.0-1.x86_64oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64
[root@lamop ~]# cd /etc/ld.so.conf.d/[root@lamop ld.so.conf.d]# touch oracle-x86_64.conf[root@lamop ld.so.conf.d]# echo "/usr/lib/oracle/11.1/client64/lib" > oracle-x86_64.conf [root@lamop ld.so.conf.d]# cat oracle-x86_64.conf /usr/lib/oracle/11.1/client64/lib
[root@lamop ~]# which sqlplus/usr/bin/sqlplus[root@lamop ~]# tail -n 3 /etc/profileexport ORACLE_HOME=/usr/lib/oracle/11.1/client64export LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client64/lib/:$LD_LIBRARY_PATHexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
pdo_oci
[root@lamop ~]# cd /service/software/php-5.4.17/ext/[root@lamop ext]# cp -rp pdo_oci pdo_oci_bak[root@lamop ext]# cd pdo_oci[root@lamop pdo_oci]# /service/php/bin/phpize Configuring for:PHP Api Version: 20100412Zend Module Api No: 20100525Zend Extension Api No: 220100525[root@lamop pdo_oci]# ./configure --with-php-config=/service/php/bin/php-config --with-pdo-oci=instantclient,/usr,11.1.0.1[root@lamop pdo_oci]# make && make installInstalling shared extensions: /service/php/lib/php/extensions/no-debug-zts-20100525/[root@lamop pdo_oci]# ls -l /service/php/lib/php/extensions/no-debug-zts-20100525/total 128-rwxr-xr-x 1 root root 129213 Nov 13 21:12 pdo_oci.so
oci8
[root@lamop ~]# cd /service/software/php-5.4.17/ext/[root@lamop ext]# cp -rp oci8 oci8_bak[root@lamop ext]# cd oci8[root@lamop oci8]# /sbin/ldconfig [root@lamop oci8]# /service/php/bin/phpize CFLAGS="-I/usr/include/oracle/11.1/client64/" Configuring for:PHP Api Version: 20100412Zend Module Api No: 20100525Zend Extension Api No: 220100525[root@lamop oci8]# ./configure --with-php-config=/service/php/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/11.1/client64/lib/[root@lamop oci8]# make && make installInstalling shared extensions: /service/php/lib/php/extensions/no-debug-zts-20100525/[root@lamop oci8]# ls -l /service/php/lib/php/extensions/no-debug-zts-20100525total 648-rwxr-xr-x 1 root root 529458 Nov 13 21:15 oci8.so-rwxr-xr-x 1 root root 129213 Nov 13 21:12 pdo_oci.soEdit "/service/php/lib/php.ini"
extension_dir = "/service/php/lib/php/extensions/no-debug-zts-20100525/"
extension = "oci8.so"
extension = "pdo_oci.so"
[root@lamop oci8]# /service/apache/bin/apachectl stop[root@lamop oci8]# /service/apache/bin/apachectl stophttpd (no pid file) not running[root@lamop oci8]# /service/apache/bin/apachectl start[root@lamop oci8]# /service/apache/bin/apachectl starthttpd (pid 13014) already running
phpinfo
test connection oracle database
php code
<?php $db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.233)(PORT = 1521)))(CONNECT_DATA=(SID=oraprod)))"; $conn = oci_connect("zwc","zwc",$db); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);}$stid = oci_parse($conn, 'SELECT * FROM v$version');oci_execute($stid);echo "<table border='1'>\n";while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "<tr>\n"; foreach ($row as $item) { echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n"; } echo "</tr>\n";}echo "</table>\n";?>
THE END
- Configuration PHP5.4 oci8 MySQL5.5 on CentOS6 x86_64
- linux centos6.5 2.6.32-431.el6.x86_64 php5.5.9 apache2.4.7 mysql5 最新快速编译安装
- linux centos6.5 2.6.32-431.el6.x86_64 php5.5.9 apache2.4.7 mysql5 最新快速编译安装
- centOS6.4 RedHat 安装 apache2.4 php5.6 mysql5.5
- RHEL5.4-x86_64 + PHP5.3.2 + APACHE2.2.15 + MYSQL5.1.46 安装
- centos6.7、centos6.5下yum方式搭建lnmp环境,php5.4/mysql5.5
- centos6.7、centos6.5下yum方式搭建lnmp环境,php5.4/mysql5.5
- CENTOS6下PHP5.6的安装 oci8 pdo-oci
- CentOS6.5系统下安装Apache2.4+PHP5.6+Mysql5.5 (LAMP)
- CentOS6.5系统下安装Apache2.4+PHP5.6+Mysql5.5 (LAMP)
- CentOS6.5系统下安装Apache2.4+PHP5.6+Mysql5.5 (LAMP)
- CentOS6.5系统下安装Apache2.4+PHP5.6+Mysql5.5 (LAMP)
- CentOS6.4 64位系统下安装 php5.2.17 + apache2.2+mysql5.5
- CentOS6.2+MySQL5.5+Nginx+PHP5.3.14安装文档
- centos6.5+nginx1.7+php5.6+mysql5.6
- 【新】centos6.5+nginx1.7+php5.6+mysql5.6【二】
- CentOS6.5 PHP5.4.0+Apache2.4.1+MySQL5.5.21 编译安装
- lnmp安装 centos6.5+mysql5.6.17+nginx1.8.0+php5.5.12
- 11.13数据结构----树与森林
- java学习笔记1-关于throw和throws的一点总结
- 大公司面试题之二叉查找树转双向链表
- UVa 442 Matrix Chain Multiplication
- 经典SQL语句大全
- Configuration PHP5.4 oci8 MySQL5.5 on CentOS6 x86_64
- C#学习笔记之三:数组
- At least one JAR was scanned for TLDs yet contained no TLDs
- 一个封装好的使用完成端口的socket通讯类
- 常用Javascript数据验证(一)
- Dot In Number
- 编译原理
- PPT双屏显示
- hdu 4325