成功安装Mysql+Apache2+php5过程
程序员文章站
2022-03-19 20:16:43
...
下载下列文件至/usr/local/src/
Apache2.tar.gz
MySQL-5.0.22.tar.gz
php-5.1.2.tar.gz
解压缩:
#tar xvzf Apache2.tar.gz
#tar xvzf mysql-5.0.22.tar.gz
#tar xvzf php-5.1.2.tar.gz
#cd .. //在/usr/local/目录下创建文件夹
# mkdir apache
# mkdir mysql
# mkdir php
//Mysql安装过程
#cd ../mysql //找到/usr/local/mysql文件夹
#groupadd mysql
#usseradd -g mysql mysql
#cd ../mysql-5.0.22 //找到/usr/local/src/mysql-5.0.22文件夹
#./configure --PRefix=/usr/local/mysql --localstatedir=/var/lib/mysql/ --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-mysqld-user=mysql --enable-assembler --with-extra-charsets=all
#make ; make install
/usr/local/mysql/bin/mysql_install_db //初始化mysql
//对mysql进行配置
#chown –R root /usr/local/mysql
#chown –R mysql /var/lib/mysql/
#chgrp –R mysql /usr/local/mysql
#cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe –user=mysql & //启动mysql
/usr/local/mysql/bin/mysqladmin –u root –p passWord 123 //将密码改为123
enter password:
//测试一下新密码
/usr/local/mysql/bin/mysql –u root –p mysql
enter password: //如果顺利的话就能进入mysql了.
//Apache安装过程
./configure --prefix=/usr/local/apache --enable-mods=shared=all --enable-module=so --disable-info
make
make install
apache安装过程中,遇到libiconv.so.2的问题,解决方法如下:
ln –sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
//在窗口栏中敲入本机ip,如果出现著名的羽毛网页,就算成功了….
//Php安装过程
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-calendar --with-openssl=/usr/ --with-config-file-path=/usr/local/php
make
make install
cp /usr/local/src/php-5.1.2/php.ini-dist /usr/local/lib/php.ini
#cd usr/local/apache/conf
//然后打开httpd.conf在相应的地方进行修改
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DocumentRoot "/usr/local/apache/htdocs"
LoadModule php5_module modules/libphp5.so
//把测试的.php文件放入/usr/local/apache/htdocs/,在窗口栏中如能打开页面,则大功告成了
//常见问题1:ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
//解决方法: 权限问题
chown -R mysql /var/lib/mysql/
//常见问题2:Warning: MySQL Connection Failed: Can't connect to local MySQL server
// through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9
//解决方法: 将/tmp/mysql.sock link 到 /var/lib/mysql 目录里即可:
linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
Apache2.tar.gz
MySQL-5.0.22.tar.gz
php-5.1.2.tar.gz
解压缩:
#tar xvzf Apache2.tar.gz
#tar xvzf mysql-5.0.22.tar.gz
#tar xvzf php-5.1.2.tar.gz
#cd .. //在/usr/local/目录下创建文件夹
# mkdir apache
# mkdir mysql
# mkdir php
//Mysql安装过程
#cd ../mysql //找到/usr/local/mysql文件夹
#groupadd mysql
#usseradd -g mysql mysql
#cd ../mysql-5.0.22 //找到/usr/local/src/mysql-5.0.22文件夹
#./configure --PRefix=/usr/local/mysql --localstatedir=/var/lib/mysql/ --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-mysqld-user=mysql --enable-assembler --with-extra-charsets=all
#make ; make install
/usr/local/mysql/bin/mysql_install_db //初始化mysql
//对mysql进行配置
#chown –R root /usr/local/mysql
#chown –R mysql /var/lib/mysql/
#chgrp –R mysql /usr/local/mysql
#cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysqld_safe –user=mysql & //启动mysql
/usr/local/mysql/bin/mysqladmin –u root –p passWord 123 //将密码改为123
enter password:
//测试一下新密码
/usr/local/mysql/bin/mysql –u root –p mysql
enter password: //如果顺利的话就能进入mysql了.
//Apache安装过程
./configure --prefix=/usr/local/apache --enable-mods=shared=all --enable-module=so --disable-info
make
make install
apache安装过程中,遇到libiconv.so.2的问题,解决方法如下:
ln –sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
//在窗口栏中敲入本机ip,如果出现著名的羽毛网页,就算成功了….
//Php安装过程
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-calendar --with-openssl=/usr/ --with-config-file-path=/usr/local/php
make
make install
cp /usr/local/src/php-5.1.2/php.ini-dist /usr/local/lib/php.ini
#cd usr/local/apache/conf
//然后打开httpd.conf在相应的地方进行修改
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DocumentRoot "/usr/local/apache/htdocs"
LoadModule php5_module modules/libphp5.so
//把测试的.php文件放入/usr/local/apache/htdocs/,在窗口栏中如能打开页面,则大功告成了
//常见问题1:ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
//解决方法: 权限问题
chown -R mysql /var/lib/mysql/
//常见问题2:Warning: MySQL Connection Failed: Can't connect to local MySQL server
// through socket '/tmp/mysql.sock' (111) in /home/httpd/html/show.php on line 9
//解决方法: 将/tmp/mysql.sock link 到 /var/lib/mysql 目录里即可:
linux# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
上一篇: php建立Ftp连接的方法_php技巧
下一篇: php中使用sftp教程_php技巧
推荐阅读
-
解决Mysql 8.0.17 winx64版本安装过程中遇到的问题
-
win7下memCache的安装过程(具体操作步骤)_PHP
-
Python下opencv库的安装过程及问题汇总
-
CodeIgniter上传图片成功的全部过程分享_PHP教程
-
Ruby On Rails上手笔记(安装使用全过程)
-
MySQL 5安装过程中遇到的问题的解决
-
Ubuntu16.04下Nvidia显卡驱动安装过程及心得
-
Oracle 11g 安装成功后在Linux开机利用chkconfig自动启动设置
-
安装 pyinstaller 失败解决过程
-
Ecshop安装过程中的的相关问题:cls_image::gd_version()和不支持JPEG