您的位置:首页 > 编程语言 > PHP开发

Slackware 14上配置MySQL与PHP笔记

2014-02-09 19:40 465 查看
{

MySQL on Slackware 14.0.

2014-02-09

Run:

mysql --version

The version of mysql included in Slackware 14 is 5.5.27.

http://dev.mysql.com/doc/refman/5.0/en/postinstallation.html

mysql_install_db will install a system database.

Then, invoke:

mysqld_safe

However, it quits immediately. Checking the log file it mentions: /var/lib/mysql/darkstar.err, it mentions that host.frm cannot be created.

strace shows that it tries to access below directories:

/var/lib/mysql

/var/run/mysql

/usr/data/mysql

/usr/var/mysql

(strace command line:

strace mysqld_safe 2>&1 | vim - -n

)

http://bugs.mysql.com/bug.php?id=1279 -- According to this web page, it is a permission issue. Run the commands below to fix:

chown -R mysql /var/lib/mysql

chgrp -R mysql /var/lib/mysql

chown -R mysql /var/run/mysql

chgrp -R mysql /var/run/mysql

}

{

Second step after running mysql_install_db is to run:

mysqladmin -u root password 'pwd...'

Now I can access mysql using the "mysql" command (alternatively, connection can be tested via "telnet localhost 3306" if mysqld_safe is used; Slackware start script doesn't allow 3306 access):

mysql --user=root --password='pwd...'

But slackware still doesn't automatically start the server.

http://www.linuxquestions.org/questions/slackware-14/how-to-auto-start-my-sql-server-upon-reboot-404452/ -- according to
this post, I ran the following command and it works:

chmod ugo+x /etc/rc.d/rc.mysqld

}

{

PHP version 5.4.7

First we need to know where the root directory for PHP resides. For this, we check the php initialization file:

vim -R /etc/httpd/php.ini

http://php.net/manual/en/security.cgi-bin.doc-root.php -- by default, doc_root equals the Apache document root, which can be found in httpd.conf, which is /srv/httpd/htdocs.
Also, uncomment the "Include /etc/httpd/mod_php.conf" line to enable PHP. A restart is required.

I didn't modify doc_root. I just put phpMyAdmin files at /srv/httpd/htdocs/phpmyadmin. Then, I found that, when I access
http://localhost/phpmyadmin, it shows the directory listing instead invoking index.php. I checked httpd.conf and found the DirectoryIndex configuration in mod_dir. Configure it to support index.php:

<IfModule dir_module>

DirectoryIndex index.html index.php

</IfModule>

PHP can also be used from the command line. To run it, just use the "php" command (where "^D" means pressing Ctrl-D):

php

<?php echo 'Robbie is a hacker.'; ?>

^D

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: