Home >Backend Development >PHP Problem >Linux php5.4 installation tutorial
linux php5.4 installation method: first install apache and decompress php; then compile and install; then copy "php.ini-production" to the lib directory and rename it "php.ini"; final modification "httpd.conf" file is enough.
Recommended: "PHP Video Tutorial"
Install php5.4.4 under linux
Step 1: Install apache
Step 2: Unzip php
[root@test02 software]# tar zxvf php-5.4.4.tar.gz
Step 3: Compile and install
[root@test02 php-5.4.4]# ./configure --prefix=/usr/local/php5.4 --with-apxs2=/usr/local/httpd2.2.22/bin/apxs --with-mysql
This will generate a libphp5.so in the /usr/local/httpd2/modules directory, and
# will be automatically added to httpd.conf ##LoadModule php5_module modules/libphp5.so This sentence Copy php.ini-production in the php decompression directory to the /usr/local/httpd2/lib directory Download and rename it to php.ini Step 4: Modify httpd.conf so that apache can recognize the extension of php In httpd Add at the end of .conf<FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP, but nothing else, we'd use this: <FilesMatch "\.ph(p[2-6]?|tml)$"> SetHandler application/x-httpd-php </FilesMatch> And to allow .phps files to be handled by the php source filter, and displayed as syntax-highlighted source code, use this: <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch>Restart apache
The above is the detailed content of Linux php5.4 installation tutorial. For more information, please follow other related articles on the PHP Chinese website!