Both sides previous revisionPrevious revision | Last revisionBoth sides next revision |
howtos:setup_apache_php_mysql [2012/09/12 19:07 (UTC)] – ADDED: php timezone change and httpd server name info. Left the formatting for the author to do. Moved SOURCES to the bottom. arfon | howtos:setup_apache_php_mysql [2012/09/12 19:30 (UTC)] – Please check how I placed the <code> tags differently so that the text indentation respects the bullets. alienbob |
---|
| |
* Install the Apache (httpd), php and MySQL packages from the Slackware discs or Slackpkg. | * Install the Apache (httpd), php and MySQL packages from the Slackware discs or Slackpkg. |
| * Fix php time zone (many apps will complain about this if you don't do it). Edit '''/etc/httpd/php.ini''' and find the following line and uncomment it: <code> |
* Fix php time zone (many apps will complain about this if you don't do it). Edit '''/etc/httpd/php.ini''' and find the following line and uncomment it: | |
<code> | |
date.timezone = America/Chicago <--change to correct time zone | date.timezone = America/Chicago <--change to correct time zone |
</code> | </code> |
* As the root user, open the '''/etc/httpd/httpd.conf''' Apache configuration file with your preferred text editor. Then, find the following line and uncomment it (delete the '#' character at the start of the line): | * As the root user, open the '''/etc/httpd/httpd.conf''' Apache configuration file with your preferred text editor. Then, find the following line and uncomment it (delete the '#' character at the start of the line): <code> |
| Include /etc/httpd/mod_php.conf |
<code>Include /etc/httpd/mod_php.conf</code> | </code> Now your Apache will include the PHP module when it starts. |
| * Set a server name (if your machine's IP doesn't resolve to a name). Edit the '''/etc/httpd/httpd.conf''' and uncomment the following line: <code> |
Now your Apache will include the PHP module when it starts. | |
| |
* Set a server name (if your machine's IP doesn't resolve to a name). Edit the '''/etc/httpd/httpd.conf''' and uncomment the following line: | |
<code> | |
ServerName www.example.com:80 <--change www.example.com to an IP or your machine's name | ServerName www.example.com:80 <--change www.example.com to an IP or your machine's name |
</code> | </code> |
* Optionally (but recommended), you can configure Apache to use an '''index.php''' file as your directory index. You just have to search the following line...: | * Optionally (but recommended), you can configure Apache to use an '''index.php''' file as your directory index. You just have to search the following line...: |
* Optionally 2, if you use Perl for web scripts, you may want to add '''index.pl''' also. | * Optionally 2, if you use Perl for web scripts, you may want to add '''index.pl''' also. <code> |
| <IfModule dir_module> DirectoryIndex index.html </IfModule> |
<code> <IfModule dir_module> DirectoryIndex index.html </IfModule> </code> | </code> ... and change it to: <code> |
| <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> |
... and change it by: | </code> Please note the '''index.php''' part added. You can now __save__ and close your '''/etc/httpd/httpd.conf''' file and restart your Apache server in order to have your modifications applied. As root, execute: <code bash> |
| apachectl restart |
<code> <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> </code> | </code> |
| |
Please note the '''index.php''' part added. You can now __save__ and close your '''/etc/httpd/httpd.conf''' file and restart your Apache server in order to have your modifications applied. As root, execute: | |
| |
<code bash>apachectl restart</code> | |
| |
\\ | \\ |
* If you want your Apache server to start automatically when you start your box, you can change the permissions of the '''/etc/rc.d/rc.httpd''' file. Execute the following command as root: | * If you want your Apache server to start automatically when you start your box, you can change the permissions of the '''/etc/rc.d/rc.httpd''' file. Execute the following command as root: <code bash> |
| * chmod 755 /etc/rc.d/rc.httpd |
| </code> Now your Apache server will start automatically when your system boots. \\ \\ In order to configure your MySQL installation, please see the [[howtos:install_mysql_on_slackware|Install MySQL On Slackware]] doc. |
| |
<code bash>chmod 755 /etc/rc.d/rc.httpd</code> | |
| |
Now your Apache server will start automatically when your system boots. | ===== Final Considerations ===== |
| |
\\ | * Normally you would want to test your recent changes in order to know if they have worked. After restarting Apache, create a '''test.php''' file on your '''/var/www/htdocs/''' directory with the following: <code php> |
In order to configure your MySQL installation, please see the [[howtos:install_mysql_on_slackware|Install MySQL On Slackware]] doc. | <?php phpinfo(); ?> |
| </code> Now you can open your favorite web browser to the following URL: http://localhost/test.php . If you your PHP installation's settings are displayed, then you have configured your Apache correctly, otherwise, please re-check this documentation (getting sure you have followed every step correctly), or contact us at ##slackware on FreeNode. |
| |
| |
== Final Considerations == | ===== Sources ===== |
* Normally you would want to test your recent changes in order to know if they have worked. After restarting Apache, create a '''test.php''' file on your '''/var/www/htdocs/''' directory with the following: | |
| |
<code php> | |
<?php phpinfo(); ?> | |
</code> | |
| |
Now you can open your favorite web browser to the following URL: http://localhost/test.php . If you your PHP installation's settings are displayed, then you have configured your Apache correctly, otherwise, please re-check this documentation (getting sure you have followed every step correctly), or contact us at ##slackware on FreeNode. | |
| |
\\ | |
==== Sources ==== | |
<!-- If you are copying information from another source, then specify that source --> | <!-- If you are copying information from another source, then specify that source --> |
* Original source: [[http://slackware-es.com/tutoriales/administracion/configurar-apache-php-y-mysql-en-slackware-linux]] | * Original source: [[http://slackware-es.com/tutoriales/administracion/configurar-apache-php-y-mysql-en-slackware-linux]] |
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> |
* Originally written by User [[wiki:user:pavel |Pavel E.]] | * Originally written by User [[wiki:user:pavel |Pavel E.]] |
| |
{{tag>howtos apache php}} | {{tag>howtos apache php}} |