apache mysql php 源碼編譯使用方法
Jun 13, 2016 pm 12:01 PM
linux 版本 : ubuntu 12.04
今天完成了 php mysql 和apache 的配置
主要是源碼配置,
apache 主要是 2.4.2 版本
php 主要是 5.3.11 版本
mysql 主要是 5.1.62 版本
前幾天試了好幾次,出現(xiàn)了軟件的源沖突,我放了兩個(gè)源在同一個(gè)source里,后修改后,安裝沒(méi)出現(xiàn)大的問(wèn)題。
總的情況如下.
我完成的過(guò)程如下 :
apache 配置:
./configure --prefix=/usr/local/apache/ --with-libxml2 --enable-modules
=most --enable-mods-shared=all
看這apache 經(jīng)典實(shí)例寫(xiě)的。
在ubuntu上加上libxml2最新的版本,然后一切ok
make
make install
然后 輸入127.0.0.1 可以看見(jiàn)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 配置中小心點(diǎn),并且小心其中的提示
我便是在小中度過(guò)那個(gè)./configure 的,然后就是順利的
make
make install
由于要配置文件復(fù)制到etc目錄下
sudo cp /mypath/mysql /etc/my.cnf
[mysqld]# 設(shè)置默認(rèn)為INNODB表,支持事務(wù):default-storage-engine=INNODB
# 設(shè)置默認(rèn)的字符集UTF-8:
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8
# mysql啟動(dòng)用戶
user=mysql
[client]
default-character-set=utf8
為了讓普通的用戶啟動(dòng)mysql 賦予mysql目錄如下權(quán)限
sudo chown -R mysql:mysql /usr/local/mysql
然后,切換到mysql的用戶下,發(fā)現(xiàn)mysql啟動(dòng)了
ps aux | grep mysqld
如果有 /usr/local/mysql/bin/ 。。。 說(shuō)明啟動(dòng)了mysql,mysql配置ok
在
Php 配置:
最復(fù)雜的屬php的配置,關(guān)鍵在于那個(gè)模塊有點(diǎn)多
配置和安裝的時(shí)間有點(diǎn)長(zhǎng),有時(shí)候 我還認(rèn)為是死機(jī)呢?
./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中報(bào)出缺少好多組件,唉。。 一個(gè)一個(gè)填上 例如 bz2 和zlib 和ncurses 三個(gè)組件添加完后
configure 立即成功了,然后呢? make ok make test 出問(wèn)題。。。。。?? 無(wú)語(yǔ)了但是 make install
ok
就需要對(duì)php 配置了
建立 php.ini 文件。
寫(xiě)入如下的配置:
error_log = /usr/local/php/php_error.log
date.timezone = "Asia/ShangHai"
session.save_path = "/tmp"
對(duì)conf/httpd.conf 修改在 LoadModules php5_modules modules/libphp5.so 填上
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php-source .phps
apache其他配置信息也寫(xiě)在httpd.conf文件里。例如 主目錄位置:

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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

PHPisaserver-sidescriptinglanguageusedforwebdevelopment,especiallyfordynamicwebsitesandCMSplatformslikeWordPress.Itrunsontheserver,processesdata,interactswithdatabases,andsendsHTMLtobrowsers.Commonusesincludeuserauthentication,e-commerceplatforms,for

How to start writing your first PHP script? First, set up the local development environment, install XAMPP/MAMP/LAMP, and use a text editor to understand the server's running principle. Secondly, create a file called hello.php, enter the basic code and run the test. Third, learn to use PHP and HTML to achieve dynamic content output. Finally, pay attention to common errors such as missing semicolons, citation issues, and file extension errors, and enable error reports for debugging.

TohandlefileoperationsinPHP,useappropriatefunctionsandmodes.1.Toreadafile,usefile_get_contents()forsmallfilesorfgets()inaloopforline-by-lineprocessing.2.Towritetoafile,usefile_put_contents()forsimplewritesorappendingwiththeFILE_APPENDflag,orfwrite()w

The steps to install PHP8 on Ubuntu are: 1. Update the software package list; 2. Install PHP8 and basic components; 3. Check the version to confirm that the installation is successful; 4. Install additional modules as needed. Windows users can download and decompress the ZIP package, then modify the configuration file, enable extensions, and add the path to environment variables. macOS users recommend using Homebrew to install, and perform steps such as adding tap, installing PHP8, setting the default version and verifying the version. Although the installation methods are different under different systems, the process is clear, so you can choose the right method according to the purpose.

Common problems and solutions for PHP variable scope include: 1. The global variable cannot be accessed within the function, and it needs to be passed in using the global keyword or parameter; 2. The static variable is declared with static, and it is only initialized once and the value is maintained between multiple calls; 3. Hyperglobal variables such as $_GET and $_POST can be used directly in any scope, but you need to pay attention to safe filtering; 4. Anonymous functions need to introduce parent scope variables through the use keyword, and when modifying external variables, you need to pass a reference. Mastering these rules can help avoid errors and improve code stability.

UsemultilinecommentsinPHPforfunction/classdocumentation,codedebugging,andfileheaderswhileavoidingcommonpitfalls.First,documentfunctionsandclasseswith/*...*/toexplainpurpose,parameters,andreturnvalues,aidingreadabilityandenablingIDEintegration.Second,

Installing PHP is not complicated for novices. The key is to clarify the system environment and version requirements and follow the steps. First, you need to confirm the operating system (Windows, macOS or Linux) and choose a stable version such as PHP8.1 or 8.2; secondly, you can install it through manual installation, using integrated environments (such as XAMPP, WAMP) or package management tools (such as apt-get and brew). Then configure environment variables to ensure that the command line can recognize PHP instructions and run through the phpinfo() page test; finally pay attention to common problems, such as Apache port occupation, php.ini file path errors and extensions not enabled, etc., and check them one by one to complete the installation smoothly.

Mastering the commonly used operators of PHP can deal with most development scenarios, mainly including: 1. Arithmetic operators ( , -, , /, %) are used for mathematical calculations and support dynamic variable operations, but pay attention to the problems that may be caused by automatic type conversion; 2. Comparison operators (==, ===, !=, >
