Configure Apache and PHP on Linux
This is a guide on Configure Apache and PHP on Linux.
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 = 400", "post_max_size = 30M", "upload_tmp_dir =/mytemp", "upload_max_filesize = 20M", "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" or "/etc/init.d/httpd restart" to restart apache service
|