E.M. Total Video Converter Command Line |
Install Apache MySQL and PHP on Linux Server
Install Apache MySQL and
PHP
This will install the basic components for a dynmaic,
database-driven web site. We use yum to handle
dependencies and gather all of the required packages.
1. Install Apache (httpd), PHP, MySQL (server and
client), and the component that allows php to talk to
mysql.
yum -y install httpd php mysql mysql-server php-mysql
2. Configure the new services to start automatically
/sbin/chkconfig httpd on
/sbin/chkconfig --add mysqld [this is not required with FC4 and above]
/sbin/chkconfig mysqld on
/sbin/service httpd start
/sbin/service mysqld start
3. IMPORTANT! Set up the mysql database root
password. Without a password, ANY user on the box
can login to mysql as database root. The mysql root
account is a separate password from the machine root
account.
mysqladmin -u root password 'new-password' [quotes are required]
4. Make additional security-related changes to mysql.
mysql -u root -p
mysql> DROP DATABASE test; [removes the test database]
mysql> DELETE FROM mysql.user WHERE user = ''; [Removes anonymous
access]
mysql> FLUSH PRIVILEGES;
5. Following the above steps, the document root for
Apache is /var/www/html/
Create a test PHP script (such as phpinfo.php) and place
it in the document root. A useful test script sample:
<?php
phpinfo();
?>
PHP configuration
Open terminal, type "find / -name php.ini" to find the
configuration file
open the directory where the file is saved (cd /etc) and
then use "vi php.ini" to edit it.
type "/max_execution_time" to find the string and set
its value to a fit value (300).
Set "max_input_time = 600", "memory_limit = 500M",
"post_max_size = 350M", "upload_tmp_dir =/mytemp",
"upload_max_filesize = 300M", "allow_url_fopen = Off"
if the directory /mytemp not exist, type "mkdir /mytemp"
to create it and then set its permission to make the
apache's user have the permission to add and delete file
from the directory.
Apache configuration
type"find / -name httpd.conf" to find the configuration
file,
open the directory where the file is saved (cd
/etc/httpd/conf) and then type"vi /etc/php.ini" to edit
it.
type "/DocumentRoot" to find the string and change the
value to your document root path (/html)
Set "User myuser", "Group myuser"
type "/usr/sbin/useradd -m -s /bin/bash myuser" to
create the user "myuser" and its group is "myuser"
type "passwd myuser" to set the password of the user
"myuser"
type the following arguments to set the permission on
"myuser"
chown -v myuser:myuser /mytemp (upload temp directory)
chmod 745 /mytemp
find '<Directory "/html">', add "php_admin_value
open_basedir /html" under the line.
Set "Options -Indexes FollowSymLinks", "ServerSignature
off", "ServerTokens prod"
To learn more about apache security, please refer to
Security Tips - Apache HTTP Server.
Install wine
yum install wine
Install php-xml
yum install php-xml
Installing APC
APC is a PHP extension that can be installed using PECL.
PECL comes with the php-pear package, so we install that
now:
yum install php-pear
Furthermore we must install some APC dependencies so
that PECL can build APC:
yum install php-devel httpd-devel
yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'
Now that all dependencies are installed, we can install
APC as follows:
pecl install apc
type "vi /etc/php.d/apc.ini", add the following
arguments to the file
extension=apc.so
apc.enabled=1
apc.shm_size=30
apc.rfc1867=1
type vi /etc/php.ini, add the following arguments to the
end of the file:
extension=apc.so
apc.rfc1867=1
type " /sbin/service httpd restart" to restart apache
service
|
|
|
|