Reinstall PostgreSQL + Apache + PHP

Source: Internet
Author: User
1. Uninstall:
Rpm-e httpd -- nodeps uninstall Apache
Rpm-Qa | grep PostgreSQL finds related packages and deletes them in reverse order.
Delete the PhP5 folder under/usr/local and uninstall PHP

2. Download The tar.gz package from the official network. Apache corresponds to the httpd package. Decompress the package with tar-xzvf.

3. First install PostgreSQL:
Go to the postgresql-8.3.3 directory, first./configure -- help | less to figure out the role of some of the options.
./Configure -- prefix =/usr/local/pgsql

Make

Make install
Installation is complete.

Sudo useradd postsql and sudo passwd postsql set the password and use usermod to join the wheel group to grant sudo permissions.
Go to/usr/local/pgsql, create a data folder, and grant postsql access permissions (this is equivalent to using postsql as the superuser of postsql ). Initialization:
$ Postpath/bin/initdb-d $ postpath/Data
Pg_ctl-d $ postpath/data-l logfile start postgresql service.
Create a database and check whether the installation is correct.
You may need to modify the pg_mirror.conf and PostgreSQL. conf files under $ postpath/data to grant access permissions.

4. install Apache:
./Configure -- prefix =/Server/soft/apache2

-- Enable-proxy

-- Enable-proxy-AJP

-- Enable-SSL

-- Enable-Dav

-- Enable-Dav-FS

-- Enable-Dav-Lock

-- Enable-Rewrite

-- Enable-so

Make

Make install
Go to Apache/bin and start sudo./apachectl-K start to start the HTTPd service.

5. install PHP:
. /Configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-zlib -- With-Gd -- With-JPEG-dir -- -PNG-dir -- enable-mbstring-with-PDO-pgsql =/Server/soft/PostgreSQL/-- With-libxml-Dir =/usr/lib/libxml2
Make
Make install
Make Test Check

6. Configure/usr/local/Apache/CONF/httpd. conf for httpd after installation, and add the following two sections:
Options followsymlinks

AllowOverride none

Order allow, deny

Allow from all

......

Servername test.cy.cn

DocumentRoot/MS/wwwroot/test

Directoryindex index. php index.htm index.html

And write test. php In the/MS/wwwroot/test directory:

Echo "hello ";

After the host is configured, you can access test.cy.cn. However, Apache does not support parsing PHP files, so it only prints the text (including ECHO.

7. Configure Apache to parse the PHP file and add the following in httpd. conf:
Loadmodule php5_module modules/libphp5.so
......
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP. inc
Addtype application/X-httpd-PHP. cfm
Addtype application/X-httpd-PHP. aspx
Restart Apache.

8. After installation, you can use phpinfo () to print the parameters used in configure, so that you can easily configure the same parameters as other machines.

9. Use pg_dump to export the table
Pg_dump-f p-Z 0 empress_by_cy> ~ /Empress_by_cy. SQL
When importing data, create a new database, such as test_cy,
Then Psql-D test_cy-f/home/Chengyi/impress/SQL/empress_by_cy. SQL
This allows you to easily generate the same table structure on other machines.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.