Difference between revisions of "Talk:Server"

From ArchWiki
Jump to: navigation, search
(Configuration: LAMP has more updated version.)
(Delete out of dated mysql info.)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Original Document ==
 
  
{{Box Note|This document was the original and is kept here for reference during the rewrite}}
 
 
==LAMP==
 
 
=== Configuration ===
 
 
* Remember to add a file handler for .phtml if you need it in /etc/httpd/conf/extra/php5_module.conf:
 
DirectoryIndex index.php index.phtml index.html
 
 
suggestion - Add your document root as follows:
 
open_basedir = /home/:/tmp/:/usr/share/pear/:/srv/http
 
 
* Restart the Apache service to make changes take effect (as root):
 
# /etc/rc.d/httpd restart
 
 
* Test PHP with a simple, but very informative script:
 
<html>
 
<head>
 
<title>PHP Test Page</title>
 
</head>
 
<body>
 
This is Arch Linux, running PHP.
 
<?php
 
  phpinfo();
 
?>
 
</body>
 
</html>
 
 
Save this file as <code>test.php</code> and copy to <code>/srv/http/</code> or to <code>~/public_html</code> if you permitted such a configuration.<!-- Also, remember to make it executable (<code>chmod o+x test.php</code>).-->
 
 
* Test PHP: http://localhost/test.php or http://localhost/~myname/test.php
 
 
'''If you continue to have problems''', edit your /etc/httpd/conf/httpd.conf file with the following information
 
 
* Edit your httpd.conf file
 
# nano /etc/httpd/conf/httpd.conf
 
 
* Under <code><IfModule mime_module></code>
 
AddType application/x-httpd-php .php
 
AddType application/x-httpd-php-source .phps
 
 
* Restart Apache
 
# /etc/rc.d/httpd restart
 
 
Be sure to test the page again to verify it's working properly (as stated above).
 
 
==== MySQL ====
 
* Configure MySQL as described at the [[MySQL]] wiki.
 
 
* Edit <code>/etc/php/php.ini</code> (this is in <code>/usr/etc</code> on older systems) to uncomment the following line (''By removing <code>;</code>''):
 
;extension=mysql.so
 
 
* You can add minor privileged users for your web scripts by editing the tables found in the <code>mysql</code> database. You have to restart MySQL for changes to take effect. Don't forget to check the <code>mysql/users</code> table. If there's a second entry for root and your hostname is left with no password set, everybody from your host probably could gain full access. Perhaps see next section for these jobs.
 
 
* Run in terminal (as root):
 
# /etc/rc.d/mysqld start
 
 
* MySQL should now be running. Test by visiting <code>http://localhost/phpMyAdmin</code> in a web browser - for testing by phpMyAdmin, you should have installed phpMyAdmin (<code>pacman -S phpmyadmin</code>). It should display phpMyAdmin main page.
 
 
* Edit <code>/etc/rc.conf</code> (to start MySQL at boot):
 
DAEMONS=(... '''mysqld''' ...)
 
'''Or''' add this line to <code>rc.local</code>:
 
/etc/rc.d/mysqld start
 
 
* You can get the "<code>error no. 2013: Lost Connection to mysql server during query</code>" message instantly whenever you try to connect to the MySQL daemon by TCP/IP. This is the TCP wrappers system (tcpd), which uses the <code>hosts_access(5)</code> system to allow or disallow connections.
 
 
* If you're running into this problem, be sure to add this to your /etc/hosts.allow file:
 
  # mysqld : ALL : ALLOW
 
  # mysqld-max : ALL : ALLOW
 
  # and similar for the other MySQL daemons.
 
 
* Notes: The examples above are the simplest case, telling tcpd to allow connections from anywhere. You may wish to use a more-appropriate choice of permissible sources instead of ALL. Just make sure that localhost and the IP address (numeric or DNS) of the interface by which you connect are specified.
 
 
* You might also need to edit <code>/etc/my.cnf</code> and comment out the <code>skip-networking</code> line as such:
 
skip-networking
 
to
 
#skip-networking
 

Revision as of 13:01, 17 December 2012