Home Backend Development PHP Tutorial YUM-PHP环境筹建

YUM-PHP环境筹建

Jun 13, 2016 am 11:19 AM
httpd mysql nbsp php zend

YUM-PHP环境搭建
用yum安装Apache,Mysql,PHP.

用yum安装Apache,Mysql,PHP.
2.1安装Apache
yum install httpd httpd-devel
安装完成后,用/etc/init.d/httpd start 启动apache
设为开机启动:chkconfig httpd on
2.2 安装mysql
2.2.1 yum install mysql mysql-server mysql-devel
同样,完成后,用/etc/init.d/mysqld start 启动mysql
2.2.2 设置mysql密码

启动mysql控制台:  mysql

mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql>; FLUSH PRIVILEGES;
2.2.3 允许远程登录
mysql -u root -p
Enter Password:
mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
完成后就能用mysql-front远程管理mysql了。
2.2.4 设为开机启动
chkconfig mysqld on
3. 安装php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start



/升级默认的php5.1到5.2

vi gedit /etc/yum.repos.d/utterramblings.repo
在打开的文件中加入以下内容:
[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
保存
yum update php



安装ZendOptimizer

1、下载文件:

http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz  (32位)

http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz  (64位)

2、解压

解压后把ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp目录下的ZendOptimizer.so拷贝到某一个目录,比如/usr/local/Zend/lib/

Zend optimizer 3.3.9有一些新的改动,不需要安装了,直接在php.ini文件里面引用.so文件即可:

3、修改/etc/php.ini文件

找到:zend.ze1_compatibility_mode = Off

修改为:zend.ze1_compatibility_mode = On

在末尾加上以下文字:

[Zend Optimizer]
zend_optimizer.optimization_level=1
zend_extension="/usr/local/Zend/lib/ZendOptimizer.so"

4、重启httpd服务,通过php -v 可以看效果。



安装eaccelerator

直接yum install php-eaccelerator

如果找不到,线 yum search eaccelerator





虚拟主机安装时注意,如果出现多个域名都指向同一个目录的情况

NameVirtualHost 127.0.0.1:80    #这句一定要和 配合才可以。

DocumentRoot /var/www/html
ServerName t.dagongz.com

allow from all
Options +Indexes




DocumentRoot /var/www/html/test/
ServerName test.dagongz.com

allow from all
Options +Indexes





开启缓存Expires模块要有

ExpiresActive   on
ExpiresDefault   "access plus 86400 second"



卸载Mysql



[[email protected] ~]# rpm -qa|grep mysql

mod_auth_mysql-2.6.1-2.2

php-mysql-4.3.9-3.15

mysql-devel-4.1.20-1.RHEL4.1

mysql-4.1.20-1.RHEL4.1

mysqlclient10-3.23.58-4.RHEL4.1

libdbi-dbd-mysql-0.6.5-10.RHEL4.1


说明:rpm –qa | grep mysql 命令是为了把mysql相关的包都列出来,我上面的例子是LinuxAS4默认安装mysql的rpm软件包列表,

如果是别的Linux版本列出来的列表有可能会不一样,不过不用担心,不管是什么,卸载都从最下面的一个包开始,直到卸载掉第一个为止。

说明:rpm –e是卸载rpm包的命令,后面是包名称,最后的版本号是不用打的,比如我们下一步卸载mysqlclient10-3.23.58-4.RHEL4.1包

方法如下:

rpm –e mysqlclient


卸载Apache

[[email protected] ~]# rpm -qa|grep httpd

httpd-manual-2.0.52-25.ent

system-config-httpd-1.3.1-1

httpd-2.0.52-25.ent

httpd-suexec-2.0.52-25.ent


说明:方法跟卸载Mysql一样,不用说了吧


卸载PHP

[[email protected] ~]# rpm -qa|grep php

php-odbc-4.3.9-3.15

php-4.3.9-3.15

php-mysql-4.3.9-3.15

php-pear-4.3.9-3.15

php-ldap-4.3.9-3.15

php-pgsql-4.3.9-3.15


说明:方法跟卸载Mysql一样


注意:卸载的时候如果卸载不掉,系统一般会提示包的依赖关系,并且列出依赖的包的名称,先卸载提示依赖的包就可以了。


如果实在实在有卸载不掉的包,可以加—nodeps这个参数来卸载,比如我们卸载php-4.3.9-3.15,实在卸不掉了。


就用:

[[email protected] ~]# rpm -e php-4.3.9-3.15 --nodeps

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL: The Ease of Data Management for Beginners MySQL: The Ease of Data Management for Beginners Apr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

Can I retrieve the database password in Navicat? Can I retrieve the database password in Navicat? Apr 08, 2025 pm 09:51 PM

Navicat itself does not store the database password, and can only retrieve the encrypted password. Solution: 1. Check the password manager; 2. Check Navicat's "Remember Password" function; 3. Reset the database password; 4. Contact the database administrator.

How to view mysql How to view mysql Apr 08, 2025 pm 07:21 PM

View the MySQL database with the following command: Connect to the server: mysql -u Username -p Password Run SHOW DATABASES; Command to get all existing databases Select database: USE database name; View table: SHOW TABLES; View table structure: DESCRIBE table name; View data: SELECT * FROM table name;

How to view database password in Navicat for MariaDB? How to view database password in Navicat for MariaDB? Apr 08, 2025 pm 09:18 PM

Navicat for MariaDB cannot view the database password directly because the password is stored in encrypted form. To ensure the database security, there are three ways to reset your password: reset your password through Navicat and set a complex password. View the configuration file (not recommended, high risk). Use system command line tools (not recommended, you need to be proficient in command line tools).

How to create navicat premium How to create navicat premium Apr 09, 2025 am 07:09 AM

Create a database using Navicat Premium: Connect to the database server and enter the connection parameters. Right-click on the server and select Create Database. Enter the name of the new database and the specified character set and collation. Connect to the new database and create the table in the Object Browser. Right-click on the table and select Insert Data to insert the data.

How to copy tables in mysql How to copy tables in mysql Apr 08, 2025 pm 07:24 PM

Copying a table in MySQL requires creating new tables, inserting data, setting foreign keys, copying indexes, triggers, stored procedures, and functions. The specific steps include: creating a new table with the same structure. Insert data from the original table into a new table. Set the same foreign key constraint (if the original table has one). Create the same index. Create the same trigger (if the original table has one). Create the same stored procedure or function (if the original table is used).

Navicat connects to database error code and solution Navicat connects to database error code and solution Apr 08, 2025 pm 11:06 PM

Common errors and solutions when connecting to databases: Username or password (Error 1045) Firewall blocks connection (Error 2003) Connection timeout (Error 10060) Unable to use socket connection (Error 1042) SSL connection error (Error 10055) Too many connection attempts result in the host being blocked (Error 1129) Database does not exist (Error 1049) No permission to connect to database (Error 1000)

Navicat cannot connect to MySQL/MariaDB/PostgreSQL and other databases Navicat cannot connect to MySQL/MariaDB/PostgreSQL and other databases Apr 08, 2025 pm 11:00 PM

Common reasons why Navicat cannot connect to the database and its solutions: 1. Check the server's running status; 2. Check the connection information; 3. Adjust the firewall settings; 4. Configure remote access; 5. Troubleshoot network problems; 6. Check permissions; 7. Ensure version compatibility; 8. Troubleshoot other possibilities.

See all articles