You are not logged in.
Pages: 1
Topic closed
I've got Apache installed and working, and I've got PHP and MySQL installed. I've scoured httpd.conf, but I don't know what I need to do to get apache to pick up my PHP files.
What I want is to have the public_html file in the home directories serve php pages. I've got it serving pages, but not php yet... I tried fiddling with some extensions and the ExecCGI option, but I can't figure it out...
Thanks,
Dusty
Offline
Is the php module untaged in /etc/httpd/conf/httpd.conf
LoadModule php4_module lib/apache/libphp4.so
If you plan to run php and mysql, did you untag the mysql extension in /usr/etc/php.ini
extension=mysql.so
Markku
Offline
If you do not have this in your httpd.conf you should add it.
<IfModule sapi_apache2.c>
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php .php
AddType application/x-httpd-php-source .phps
</IfModule>
This tell to the server that if the module is loaded to use index.php as first answer as index of a dir and add the mime type of the php pages.
Offline
Somebody would tell me why I put this in the networking forum instead of Server?? So tired last night...
I already had those lines and had restarted apache, but it wouldn't work. After rebooting today, PHP was working fine... don't kwnow what I forgot to reinit before.
Now I'm having trouble with MySQL. I ran /etc/rc.d/mysqld start, but when I try to connect, I get:
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
The daemon isn't running, according to ps -A|grep mysqld. When I run mysqld start, it says done, but if I subsequently run stop, it fails. I don't know how te find out what is wrong. /var/log/mysqld.log is empty.
Oh, also, the first time I tried to run it, it said it that /usr/bin/resolveip couldn't resolve my host name or localhost. It's resolving localhost all right; I tried it, but it isn't resolving my host name. Is that causing the error? Why did that error message stop coming up when I run mysqld start?
I've never had trouble with MySQL before. I assume it's because I'm not to bright when it comes to finding and reading configuration files...
Thanks,
Dusty
Offline
I forgot to search the forum but... I did just try everything at this thread:
http://bbs.archlinux.org/viewtopic.php?t=1361
And It's still not working.
Sarah was right. I've never had a distro make such a fool of me before. :-D
Dusty
Offline
Had to run mysql_install_db AND chmod mysql.mysql the files that it created. It's working now, Sarah was only part right and I'm only a little slow. *sigh*
Dusty
Offline
Could you express it more precise? What did you do? Php mysql and apache is one of the things I have to do, 2.
Frumpus ♥ addict
[mu'.krum.pus], [frum.pus]
Offline
Here's what works for me. Mostly this is shamelessy stolen from rasat's post in the link above, but I made a lot of alterations, removing stuff that isn't necessary with the latest apache, changing some stuff... if there is a problem, try comparing it to that link.
INSTALL:
pacman -S apache
pacman -S php
pacman -S mysql
APACHE:
1. Uncomment the following line in /etc/httpd/conf/httpd.conf :
it[/i]
#LoadModule php4_module /usr/lib/apache/libphp4.so
2. Add line in /etc/host :
127.0.0.1 localhost.localdomain localhost
Or if you want a different hostname:
127.0.0.1 localhost.localdomain localhost myhostname
3. Edit /etc/rc.conf :
If you set a hostname in step two, the hostame variable should be the same. otherwise localhost:
#
# Networking
#
HOSTNAME="localhost"
4. Run in terminal (root):
$ /etc/rc.d/httpd start
5. Apache should now be running. Test by going to http://localhost/ in a web browser.
6. Edit /etc/rc.conf (to start Apache at boot):
Daemons=(some daemons now add httpd)
OR add this line in rc.local:
/etc/rc.d/httpd start
7. If you want user directories (ie: ~/public_html on the machine is accessed as http://localhost/~user/) to be available on the web, uncomment the following lines in /etc/httpd/conf/httpd.conf:
UserDir public_html
and
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
PHP:
1. Edit /usr/etc/php.ini and uncomment the following line:
;extension=mysql.so
2. Uncomment these lines in /etc/httpd/conf/httpd.conf:
(I think they were commented out...)
<IfModule sapi_apache2.c>
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php .php
AddType application/x-httpd-php-source .phps
</IfModule>
3. Test PHP with a simple script:
<html>
This is a test. Say hello to Arch:
<p>
<body>
<?php
$myvar = "Hello Arch Linux";
echo $myvar;
?>
</body>
</html>
Save the file as "test.php" and copy to /home/httpd/html/ or to ~/public_html if you permitted such a configuration.
Test PHP:
http://localhost/test.php
or
http://localhost/~myname/test.php
MySQL:
1. Run in terminal (root)
$ mysql_install_db
$ chown -R mysql.mysql /var/lib/mysql
2. Run in terminal:
$ /etc/rc.d/mysqld start
3. test mysql. as root, login:
$ mysql
4. Create root password for mysql:
mysqladmin -u root password 'roots_password'
5. Add mysqld to the list of daemons in /etc/rc.conf
OR Add this line in /etc/rc.local (to start at boot):
/etc/rc.d/mysqld start
---------------------------
Hope it helps and works.
Dusty
Offline
Hope it helps and works.
Nice!! Keep it updated with the "edit" function. There is a link in the FAQ & LP topic:
http://bbs.archlinux.org/viewtopic.php?t=2250
Markku
Offline
"Nice!"?? The nice part was all your work. the rest was just a hack.
I hadn't seen The Wiki links page... what a good idea!
If anybody has advice or suggestions, PM me and I can edit the post above. Or repost it as Wiki in another topic... (In Server User, rather than networking...)
Dusty
Offline
2. Add line in /etc/host :
127.0.0.1 localhost.localdomain localhost
3. Edit /etc/rc.conf :
# # Networking # HOSTNAME="localhost"
If you want, you can change the hostname to whatever you want. Just make sure you have that whatever listed on the /etc/hosts line.
ex:
2. Add line in /etc/host :
127.0.0.1 localhost.localdomain localhost googlepoo
3. Edit /etc/rc.conf :
#
# Networking
#
HOSTNAME="googlepoo"
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
this is nice. thank you.
Frumpus ♥ addict
[mu'.krum.pus], [frum.pus]
Offline
I reposted this as wiki here:
http://bbs.archlinux.org/viewtopic.php?p=13384#13384
Keep it up to date
Dusty
Offline
Thanks so much.
Looked everywhere for a solution to RROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
your solution worked perfectly.
Offline
Offline
Pages: 1
Topic closed