当前位置 : 主页 > 网络编程 > 其它编程 >

PHP5,mysql5linux操作系统电脑资料

来源:互联网 收集:自由互联 发布时间:2023-07-02
本文章来给各位同学介绍一下关于Linux下源码编译安装apache2,PHP5,mysql5方法希望此教程对各位同深地有所帮助哦#apache代码如 本文章来给各位同学介绍一下关于Linux下源码编译安装apache2,P
本文章来给各位同学介绍一下关于Linux下源码编译安装apache2,PHP5,mysql5方法希望此教程对各位同深地有所帮助哦#apache代码如

本文章来给各位同学介绍一下关于Linux下源码编译安装apache2,PHP5,mysql5方法希望此教程对各位同深地有所帮助哦

#apache

代码如下./configure --prefix/usr/local/apache --enable-modulesso --enable-rewrite

make

make install

cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd

cd /etc/rc.d/init.d

#vi httpd

#在文件首部#!/bin/bash行下加入以下几行

# chkconfig: 2345 50 40

# description: This is a Internet www Server

#说明一下直接调用chkconfig是不行的必须加上以上两行。

#description是描述这个服务用的一定要写上对服务的描述,而且不可以是中文的

#chkconfig: 第一组数字是系统运行级2345表示的是将要设为启动的系统运行级别

#第二个数字是优先级00优先级最高当然考虑到依赖性你的服务的优先级不宜过高

#如果比自己依赖的服务的优先级更高那么您的服务将无法正常启动

#第三组数字就是杀死服务的优先级

chkconfig --add httpd

#mysql

代码如下./configure --prefix/usr/local/mysql --localstatedir/mydata/web/mysql --with-charsetutf8 --with-extra-charsetsall

make

make install

cp support-files/my-medium.cnf /etc/my.cnf

#创建mysql用户和用户组

groupadd mysql

useradd -g mysql mysql

chown -R root /usr/local/mysql

chgrp -R mysql /usr/local/mysql

chown -R mysql /var/mysql

#初始化权限数据库并不需要启动mysql

scripts/mysql_install_db --usermysql

#启动mysql, "mysqlx mysqld

chkconfig --add mysqld

#PHP

代码如下./configure --prefix/usr/local/php --with-mysql/usr/local/mysql --with-mysqli/usr/local/mysql/bin/mysql_config --with-apxs2/usr/local/apache/bin/apxs --with-gd --with-zlib --with-png --with-freetype-dir --with-config-file-path/usr/local/php/etc --enable-gd-native-ttf --with-ttf --enable-memory-limit --enable-zend-multibyte --disable-ipv6 --disable-path-info-check --with-iconv --disable-debug --with-mail --enable-mbregex --with-curl --enable-mbstringall --enable-zip --enable-exif --with-jpeg-dir/usr/lib64/

make

make install

#配置apache

代码如下# vi /usr/local/apache/conf/httpd.conf

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

#开放80端口代码如下#iptables -A INPUT -i eth0 -p TCP --dport 80 -j ACCEPT

四 、整合apache 与php代码如下# vi /usr/local/apache2/conf/httpd.conf

在最后一行加上代码如下AddType application/x-httpd-php .php

查找(设置 WEB 默认文件)代码如下DirectoryIndex index.html

替换为代码如下DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件httpd 就会执行 /var/www/error/noindex.html

找到这一段代码如下# AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:

# Options FileInfo AuthConfig Limit

#

AllowOverride none

更改为AllowOverride all

允许apache rewrite

保存httpd.conf退出Linux下源码编译安装apache2,PHP5,mysql5linux操作系统》(https://www.unjs.com)。代码如下

# /usr/local/apache2/bin/apachectl restart //重启 Apache

五、 测试代码如下vi /usr/local/apache2/htdocs/test.php

新增加下面一行并保存。代码如下

# chmod 755 /usr/local/apache2/htdocs/phpinfo.php

用浏览器打开 http://locahost/test.php

或者 http://本机ip/test.php

(如ip为192.168.4.2 则 http://192.168.4.2/test.php)

当看到php页面时表示成功

【本文由:湖北阿里云代理 http://www.558idc.com/aliyun.html 复制请保留原URL】
网友评论