apache mysql php 源码编译使用方法_php实例
linux 版本 : ubuntu 12.04
今天完成了 php mysql 和apache 的配置
主要是源码配置,
apache 主要是 2.4.2 版本
php 主要是 5.3.11 版本
mysql 主要是 5.1.62 版本
前几天试了好几次,出现了软件的源冲突,我放了两个源在同一个source里,后修改后,安装没出现大的问题。
总的情况如下.
我完成的过程如下 :
apache 配置:
./configure --prefix=/usr/local/apache/ --with-libxml2 --enable-modules
=most --enable-mods-shared=all
看这apache 经典实例写的。
在ubuntu上加上libxml2最新的版本,然后一切ok
make
make install
然后 输入127.0.0.1 可以看见it‘s work!
mysql配置:
cd mysql
sudo ./configure –prefix=/usr/local/mysql –with-mysqld-user=mysql
–with-extra-charsets=all –enable-thread-safe-client
在./configure 配置中小心点,并且小心其中的提示
我便是在小中度过那个./configure 的,然后就是顺利的
make
make install
由于要配置文件复制到etc目录下
sudo cp /mypath/mysql /etc/my.cnf
[mysqld]# 设置默认为INNODB表,支持事务:default-storage-engine=INNODB
# 设置默认的字符集UTF-8:
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8
# mysql启动用户
user=mysql
[client]
default-character-set=utf8
为了让普通的用户启动mysql 赋予mysql目录如下权限
sudo chown -R mysql:mysql /usr/local/mysql
然后,切换到mysql的用户下,发现mysql启动了
ps aux | grep mysqld
如果有 /usr/local/mysql/bin/ 。。。 说明启动了mysql,mysql配置ok
在
Php 配置:
最复杂的属php的配置,关键在于那个模块有点多
配置和安装的时间有点长,有时候 我还认为是死机呢?
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql-dir=/usr/local/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-pdo-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-mod-charset \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-curlwrappers \
--enable-exif \
--enable-ftp \
--with-gdbm \
--with-gd=shared \
--with-ttf \
--enable-gd-native-ttf \
--with-gettext \
--with-gmp \
--enable-mbstring=all \
--enable-zend-multibyte \
--with-ming=shared \
--enable-sqlite-utf8 \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-xsl \
--enable-zip \
--with-zlib \
--enable-discard-path \
--enable-force-cgi-redirect \
--enable-magic-quotes \
--enable-sigchild \
--with-ncurses \
--enable-pcntl
然后configure中报出缺少好多组件,唉。。 一个一个填上 例如 bz2 和zlib 和ncurses 三个组件添加完后
configure 立即成功了,然后呢? make ok make test 出问题。。。。。?? 无语了但是 make install
ok
就需要对php 配置了
建立 php.ini 文件。
写入如下的配置:
error_log = /usr/local/php/php_error.log
date.timezone = "Asia/ShangHai"
session.save_path = "/tmp"
对conf/httpd.conf 修改在 LoadModules php5_modules modules/libphp5.so 填上
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php-source .phps
apache其他配置信息也写在httpd.conf文件里。例如 主目录位置:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The future of PHP will be achieved by adapting to new technology trends and introducing innovative features: 1) Adapting to cloud computing, containerization and microservice architectures, supporting Docker and Kubernetes; 2) introducing JIT compilers and enumeration types to improve performance and data processing efficiency; 3) Continuously optimize performance and promote best practices.

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

You can open phpMyAdmin through the following steps: 1. Log in to the website control panel; 2. Find and click the phpMyAdmin icon; 3. Enter MySQL credentials; 4. Click "Login".

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

PHP is not dying, but constantly adapting and evolving. 1) PHP has undergone multiple version iterations since 1994 to adapt to new technology trends. 2) It is currently widely used in e-commerce, content management systems and other fields. 3) PHP8 introduces JIT compiler and other functions to improve performance and modernization. 4) Use OPcache and follow PSR-12 standards to optimize performance and code quality.

How to connect to MySQL using phpMyAdmin? The URL to access phpMyAdmin is usually http://localhost/phpmyadmin or http://[your server IP address]/phpmyadmin. Enter your MySQL username and password. Select the database you want to connect to. Click the "Connection" button to establish a connection.

不同数据库系统添加列的语法为:MySQL:ALTER TABLE table_name ADD column_name data_type;PostgreSQL:ALTER TABLE table_name ADD COLUMN column_name data_type;Oracle:ALTER TABLE table_name ADD (column_name data_type);SQL Server:ALTER TABLE table_name ADD column_name data_
