Apache + MySQL + PhP suite

Source: Internet
Author: User

Recently, an Apache + MySQL + PhP environment has to be installed. After Google, it is found that the current installation is becoming more and more simple. You don't need to bother with configuration and installation. You just need to execute a sh command.

There are several different platforms that I have accessed from Google. First, easyphp and uniform server are installed in windows;

SAMP under Solaris and XAMPP on various platforms are supported. This is also the best reputation on the Internet, but there is a problem with support for solaris10. Therefore, SAMP is recommended for the Solaris platform. I will post a detailed SAMP installation step here.

 

From: http://www.chinasolaris.com/viewthread.php? Tid = 1185 & extra = Page % 3d1

SAMP (Solaris, Apache, MySQL, PERL/Python/PHP) evolved from lamp (Linux, Apache, MySQL, and PHP). Its framework is 1.
Figure 1 SAMP framework
1. Download and install SAMP!
There are two ways to install and configure SAMP:
(1) download, install, and configure Apache, MySQL, and PHP/perl/Python respectively.
(2) download, install, and configure coolstack. Coolstack is an open-source software package that includes the most common and optimized Sun Solaris operating systems. The focus is on Apache, PHP, and MySQL. Therefore, using this package, the amp can run in the optimal state. We recommend that you install the coolstack package directly. Coolstack Official Website: http://cooltools.sunsource.net/coolstack/, you must register a valid ID before downloading. On the download page, click cool stack 1.2 to download cool stack 1.2. Here, the coolstack download page is available for the Linux, Intel x86, and amd64 versions and versions for different platforms:
Https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/DownloadSingleSoftware-Start? Productid = h.9ibe. o7lyaaaebxxugcqzu & LICENSE-x8JIBe.ofkIAAAEbYHUGcQZU = on & s_evar4 = CDs & vva_000000000000005000063844 = English & vva_00000000005000063845 = Solaris % 2010% 20os % 20 (x86)
It mainly includes the following software packages:
· Cskamp. That is, the amp package: cskapache2, cskphp5, and cskmysql32. This package has been pre-configured to ensure that it can work together after installation. MySQL is a 32-bit version.
· Cskruntime. Is the runtime package that most other packages depend on. Since it is a dependent package, you must first install this runtime package before installing other dependent packages.
· Cskmysql. MySQL 5 64-bit version package.
· Cskperl. Perl5 package and Related Extension libraries.
· Cskphplibsbundle. Various PHP extension packages depend on libraries, including three more packages:
· Cskmemcached. The famous distributed object cache tool: memcached.
· Cskruby. Ruby, rubygems, and rails packages.
· Csksquid. The squid of the Web cache tool.
· Csktomcat. The pure Java Apache Tomcat is different from Tomcat on tomcat.apache.org.
· Csklighttpd. Lightweight Web Server Lighttpd.
1. Install cskruntime!
# Bunzip2 cskruntime_1.2_x86.pkg.bz2
# Mkdir/var/tmp/cskruntime-test
# Pkgtrans cskruntime_1.2_x86.pkg/var/tmp/cskruntime-test/
# Pkgadd-D/var/tmp/cskruntime-test/
The installation process is omitted.
 2. Install cskamp
# Bunzip2 cskamp_1.2_x86.pkg.bz2
# Mkdir/var/tmp/cskamp-test/
# Pkgtrans cskamp_x86.pkg/var/tmp/cskamp-test/
# Pkgadd-D/var/tmp/cskamp-test/
The installation process is omitted.
 3. Install cskphplibsbundle
# Bunzip2 cskphplibsbundle_1.2_x86.pkg.bz2
# Mkdir/var/tmp/cskphplibsbundle-test
# Pkgtrans cskphplibsbundle_1.2_x86.pkg/var/tmp/cskphplibsbundle-test
# Pkgadd-D/var/tmp/cskphplibsbundle-test/
  4. Verify the installation version
Run the following command: # pkginfo-l cskapache2
Pkginfo-l cskapache2
Pkginst: cskapache2
Name: Apache httpd
Category: Application
Arch: i386
Version: 2.2.6
Basedir :/
Vendor: Apache
Desc: httpd is built with MPM pre-fork and modules to support PHP, SSL and Perl. pstamp:
Instdate: 8 ?? 07 2008
Hotline: Please see http://httpd.apache.org/bug_report.html
Status: Install all 2
Files: 1378 installed path names
Seven shared pathnames
55 directory
92 executable files
1 Setuid/Setgid Executable File
59831 used blocks (approximate)
Apache provides the worker module instead of the old prefork. c module.
Figure 2 and 3 are the authentication interfaces of PhP5 and MySQL 32-bit versions.


  Ii. MySQL Server initialization and startup
Copy configuration file
CP/opt/coolstack/mysql_32bit/share/MySQL/my-medium.cnf/etc/My. CNF
Add mysql users and user groups:
# Groupadd MySQL
# Useradd-G MySQL
Initialize MySQL 4 with the following command:
#/Opt/coolstack/mysql_32bit/bin/mysql_install_db

Figure 4 initialize MySQL
After MySQL is initialized, A/opt/coolstack/mysql_32bit/data directory is automatically created to set the permission for mysql users to access the data folder:
# Chown-r MYSQL: MySQL/opt/coolstack/mysql_32bit/Data
Now you can start the MySQL process:
#/Opt/coolstack/mysql_32bit/bin/mysqld_safe &
The execution process is shown in step 5.

Test the mysql client
Use commands to create a simple database
#/Opt/coolstack/mysql_32bit/bin/mysqladmin create testdb
#/Opt/coolstack/mysql_32bit/bin/MySQL
Welcome to the MySQL monitor. commands end
Your MySQL connection ID is 3
Server version: 5.0.45-standard-log Source Distribution
Type "help;" or "\ H" for help. Type "\ c" to clear the buffer.
Mysql>
Mysql> Use testdb9
Database changed
Mysql> #
Mysql> exit
(Through coolstack installation after MySQL, Character Set for UTF-8, connection calibration format utf8_general_ci.
3. Set MySQL and Apache as SMF services
SMF is a software service management tool in the Solaris 10 operating system. It replaces the service running script in/etc/*. D of the previous operating system. For those who have used Linux, the SMF function is similar to the "daemon" in "ntsys". For those who have used UNIX, this function replaces some directories/etc/rc *. d. The functions of the startup script program (which is not replaced by another one) and the super server (inetd. Users who have used Solaris 9 know that Solaris 9 does not have this management tool, which is a new feature of Solaris 10. Set MySQL and Apache as SMF services and start them with the Solaris server at the same time:
# Svcadm enable svc:/Network/csk-mysql32: Default
# Svcadm enable svc:/Network/CSK-http: cskapache2
The command to view the status of MySQL and Apache services is as follows:
# SVCs-A | grep csk-mysql32
Online 9:17:31 svc:/Network/csk-mysql32: Default
The service status can be of the following types:
? Degraded: the service has been started but is running in a restricted State.
? The service is disabled.
? Legacy_run: this service is not managed by SMF, but can be monitored by SMF.
? Maintenance, maintenance status. This service has a large number of errors and should be repaired by managers.
? Offline, the service has been started, but is offline and not online.
? Online. The service has been started and runs online.
? Uninitialized. The service is initializing.
Iv. Test the samp Environment
Start the MySQL server
# Svcadm enable csk-mysql32
Start Apache server
# Svcadm enable CSK-HTTP
Note: The commands for disabling MySQL and Apache servers are as follows:
Test Apache, select "application" | "Internet" | "Firefox Web Browser", open Firefox, and enter http: // localhost in the address bar to check whether Apache runs successfully. If the homepage titled "Cool Stack from the opensolaris web stack project" appears, Apache can successfully provide the basic HTML service. 6.

Figure 6 test the Apache server
Test whether Apache can parse the PHP document. Use VI to edit a file phpinfo. php
# Cd/opt/coolstack/apache2/htdocs/
# Vi phpinfo. php
<HTML>
<Body>
<P> Hello SAMP! </?>
<? PHP phpinfo ();?>
</Body>
</Html>
</Code>
Enter http: // localhost/phpinfo. php in the address bar. If figure 7 appears, PHP resolution is successful.

Figure 7 test whether Apache can parse the PHP document
Common troubleshooting:
If Apache cannot parse the PHP document, modify the PHP configuration file:/opt/coolstack/PhP5/lib/PHP. ini and add two lines:
Extension = "mysql. So"
Extension = "mysqli. So"
Modify the Apache configuration file/opt/coolstack/apache2/CONF/httpd. conf and add a line:
Loadmodule php5_module modules/libphp5.so. u'z4 M7 R #} "K7 F
 Summary:This document uses the Solaris version U4 and applies to open Solaris and sxde. Coolstack has three versions: 1.1, 1.2, and 1.3rc. This article uses 1.2. Amp is also mainly used on various Linux platforms, forming a famous lamp architecture. On Solaris, SAMP is a web development platform comparable to lamp, Wamp (Windows + Amp), and mlap (Mac OS + Amp.

 

In the red section, not everyone executes the same command. We should first use this command to view SVCs-A | grep CSK

Online 13:15:28 svc:/Network/HTTP: apache22-csk
Online 13:15:46 svc:/application/database/MySQL: mysql32-csk

Then use the following command according to the specific content, such as the Environment for me. Next I will use

Svcadm enable svc:/application/database/MySQL: mysql32-csk

Svcadm enable svc:/Network/HTTP: apache22-csk

To change their status from disable to online.

 

Then we start Apache and MySQL

Svcadm enable apache22-csk

Svcadm enable mysql32-csk

 

That's all.

 

 

 

 

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.