Installing PHP on a Redhat Linux 7 Server + other questions
I have a few questions.
1.
I just cannot get it to work
I downloaded php.rpm and did
rpm -Uvh php.rpm
but it still didn't work...
Is there a part of httpd.conf that I should look for?
all the php handlers are enabled...
What is wrong?
2.
Whenever I try to run a .cgi or .pl file, it says i don't have access.
i tried changing ownership and group, chown/chgrp, but nothign works.
Whats wrong?
3.
I've asked this before, and I used the FAQ i was directed to, but that didn't work.
Whenever I run any kind of file that uses a "method:POST" function, I get a "requested method:POST not allowed"
The FAQ i was directed to didn't help at all.
Can someone please help me?
Thank you all!
mairving posted this at 17:25 — 10th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Still have problems eh? Let's do this one problem at a time. Let's try to get No.2, the permissions problem fixed first. Most of these have probably already been over before but let's go over them again.
If you don't have access, then it has to be a permission problem.
Question: What is your User and Group in httpd.conf?
Question: What does ls -l show you about these .cgi or .pl files as far as the owner and group?
Question: What does ls -l tell you about the directory that is document root in httpd.conf?
Question: Is the file executable by the User and Group in httpd.conf?
Go ahead and post the answers back here. Be patient and we will get the problems solved.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 18:14 — 10th June 2001.
They have: 840 posts
Joined: Sep 2000
User apache
Group apache
however, files still work with user/group as root.
Root and apache both allow access, but httpd.conf only says apache should work.
What should the folder permissions be set to? chmod 644?
I tried .html files in the folders, but I got the same error, "you don't have permission"
mairving posted this at 12:25 — 11th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Nike_guy, for some reason I couldn't connect yesterday afternoon here so I couldn't post.
This hits the nail on the head about it being a permission problem.
It could still work if the file is owned by root. It depends upon the permissions that you have given it. Why don't you do this at the DocumentRoot folder level, i.e. if your files are in /home/httpd/ , then do this:
cd /home/
chown -R apache httpd
chgrp -R apache httpd
This changes the ownership and group, recursively for all files and directories that you have specified, in this case /home/httpd and everything in it to user & group apache. If this still doesn't work for you, do this at the DocumentRoot, ls -l /home/httpd > log.txt. This will print this info into a text file which you can paste here or email to me.
It can be difficult figuring out the relationships between chown, chgrp, & chmod. Here is some information that may be able to explain what is going on better than I could.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 02:21 — 12th June 2001.
They have: 840 posts
Joined: Sep 2000
Every time I try to install PHP, and I run ./configure it says that the CC and GCC compilers can't be found or aren't working.
Whats wrong and how do I fix these?
mairving posted this at 11:35 — 12th June 2001.
They have: 2,256 posts
Joined: Feb 2001
What about the permission problem? Fixed or not.
I have seen this is the past. For some reason on the initial install, RH will not install these by default. You can however. They should be on your install disk. gcc is the c-compiler that your system uses to compile code. If you can't find it on your install disk, check here
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 17:48 — 12th June 2001.
They have: 840 posts
Joined: Sep 2000
Well, I tried to run ./configure for the GCC compiler, it said that it could not congifure GCC because GCC was not installed yet.
There's no way I can install something that requires the same thing!
Then I downloaded it again, and tried to configure a different way, it said it couldn't find "ld"
What's wrong?
By the way, the permissions problem hasn't been fixed
mairving posted this at 12:03 — 13th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Hmm... let's try doing this the RedHat way and download their compiler here.
nike_guy_man posted this at 14:14 — 13th June 2001.
They have: 840 posts
Joined: Sep 2000
Ok, here's what I'm going to do.
I am going to reinstall RedHat, making sure I install PHP and all the other components I need.
But I have one question:
My web files are at /home/web
how do I back these files up?
mairving posted this at 14:32 — 13th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Don't reinstall. Let's try fixing this first. Did you try RedHat's version of gcc. If so what happened?
nike_guy_man posted this at 18:46 — 19th June 2001.
They have: 840 posts
Joined: Sep 2000
I installed RedHat 6.2, and PHP works now.
But Perl doesn't
I get a 500 error every time.
I think it may be my path to perl
I did
whereis perl
and it returned
/usr/bin/perl
my script is
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "Hello this is a test";
but it returns a 500 error.
please help!
Is there any other way to find the path to perl?
Or change it?
mairving posted this at 01:39 — 20th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Try running:
perl -V
to make sure that it is installed properly. I am also assuming that cgi scripts are enabled in Apache.
nike_guy_man posted this at 17:19 — 20th June 2001.
They have: 840 posts
Joined: Sep 2000
I had the wrong perl path.. it was
/usr/bin/perl5.00503 not /usr/bin/perl
Now the next problem
I cannot get MySQL to run.
I downloaded the RPM from mysql.com and that didn't work.
I downloaded the tar.gz file from mysql.com and that didn't work.
I tried to install it from the setup with RedHat 6.2, that didn't work.
When I run a .php3 file that has mysql_connect() in it, I get an error saying thats not a valid term.
Any ideas?
mairving posted this at 19:33 — 20th June 2001.
They have: 2,256 posts
Joined: Feb 2001
How did you fix the Perl path?
I hope that you changed the directory that it was in to /perl instead of changing the path in your script. If you change the path, you will have to do that in every script, kind of a pain.
As far as the MYSQL setup problem, what do you mean that it didn't work? Did it give you an error or appear to install and then not do so?
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 19:40 — 20th June 2001.
They have: 840 posts
Joined: Sep 2000
How do I change it to /perl?
When I said it didn't work, when I tried to run a php file that tries to connect to a mysql database, it gave me an error saying:
Fatal error: Call to unsupported or undefined function mysql_connect() in /home/www/sql.php3 on line 8
How do I uninstall an RPM or a .tar.gz file?
Thank you...
mairving posted this at 20:56 — 20th June 2001.
They have: 2,256 posts
Joined: Feb 2001
To change to /perl
mkdir /usr/bin/perl (if not already made)
cp -R /usr/bin/perl5.00503/* /usr/bin/perl
You can uninstall a rpm the same way that it was installed, except click the uninstall option. Little bit different on a .gz install. Most of the time just deleting all the files will suffice.
MYSQL - let's see if it installed properly first. MYSQL is a bit different than installing PHP, because it has to run as a daemon to work. To run it as a daemon (background process), usually it is started with a script called safe_mysqld. Here is how to start the daemon:
cd /pathto mysql/scripts/
./safe_mysqld &
Now try to connect to mysql, try typing in mysql and see what happens. If it gives you a no such file or directory error, then you need to put in the full path to connect. Let me know what happens after this.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 21:04 — 20th June 2001.
They have: 840 posts
Joined: Sep 2000
:(
Nothing worked.
There is no uninstall option from command line?
When I tried to change the path to perl, it said they were the same file.
MySQL said safe_mysqld was not a valid file.
It says that the command mysql is not a valid option either.
Please help!
This is very confusing!
mairving posted this at 22:01 — 20th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Using rpm from the command line, check here for rpm options. Or use rpm --help or man rpm to give you help running it.
Changed the path to perl where?
Okay let's take it step by step.
gunzip mysql(version).gz
tar -xvf mysql(version).tar
Let me know if you get stuck.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 00:56 — 21st June 2001.
They have: 840 posts
Joined: Sep 2000
I read through those instructions, but those are the same that came with the tar.gz
I found that pgsql came with RedHat6.2, but I can't figure out the commands.
When trying to connect to the pgsql, it says that my hostname is incorrect.
Where can I find the hostname?
mairving posted this at 01:25 — 21st June 2001.
They have: 2,256 posts
Joined: Feb 2001
I would use mysql since there is a ton of stuff available for it. It would help me to help you if you could elaborate a bit more on the installation problems. Does it error out on you? Or does it seem to install and not actually be installed?
This article over at Devshed may help you even more than the mysql site.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 17:21 — 21st June 2001.
They have: 840 posts
Joined: Sep 2000
Nope Nope Nope
When I try to run ./configure or ./safe_mysqld & it says that the hostname "hostname" could not be found.
Or it says that the TCP/IP port is already in use.
How do I change this?
Thanks
mairving posted this at 20:01 — 21st June 2001.
They have: 2,256 posts
Joined: Feb 2001
Now we are getting somewhere. Have you set up a hostname in this computer? You more than likely have since Apache appears to be running. A couple of things to check
-from the command line, type in hostname, tell ,me what it says. It should give you the name of your machine.
-also from the command line type in cat /etc/hosts and tell me what that says. This file should have a line like 127.0.0.1 localhost & other setting like IP Address name.
It has to know the host info first, before it can continue.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 20:48 — 21st June 2001.
They have: 840 posts
Joined: Sep 2000
hostname=parrabal
what does cat do?
is that text editor?
when i did cat /etc/hosts it just gave me a new command line
If i did pioc /etc/hosts, it give me an empty file.
/etc/hosts is empty.
Does that help?
mairving posted this at 21:03 — 21st June 2001.
They have: 2,256 posts
Joined: Feb 2001
cat is just a way of showing the files contents without having to exit the file like you do with vi.
Let's go ahead and make a couple of entries in the hosts file like this:
127.0.0.1 localhost
your IP address parrabal
Then we will try running the configure script again like so:
configure --prefix=/usr/local/mysql
make
make install
Let me know what happens.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 21:24 — 21st June 2001.
They have: 840 posts
Joined: Sep 2000
should I put my internal IP address or external?
make returns the error:
"No targets specified and no makefile found. Stop"
and make install returns this error:
"No rule to make target 'install'. stop"
Any ideas?
And when I run ./configure --prefix=/usr/local/mysql
it says "Grant tables failed to install"
help!
mairving posted this at 21:42 — 21st June 2001.
They have: 2,256 posts
Joined: Feb 2001
Use your internal address.
First things first. You have to run configure before there is anything to make.
Did you create a user and group mysql?
Interesting you don't usually get the grant table error unless there is a mysqld daemon already running. Check here for more info on the grant table problem. Also when you post back here, do this all from the command line:
ps aux > ps.txt and paste the info from this text file here.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 23:06 — 21st June 2001.
They have: 840 posts
Joined: Sep 2000
yes i created them
i did run configure before make and make install.
ps.txt:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.4 1120 68 ? S 12:12 0:05 init [3]
root 2 0.0 0.0 0 0 ? SW 12:12 0:00 [kflushd]
root 3 0.0 0.0 0 0 ? SW 12:12 0:00 [kupdate]
root 4 0.0 0.0 0 0 ? SW 12:12 0:00 [kpiod]
root 5 0.0 0.0 0 0 ? SW 12:12 0:00 [kswapd]
root 6 0.0 0.0 0 0 ? SW< 12:13 0:00 [mdrecoveryd]
root 261 0.0 0.0 1432 0 ? SW 12:13 0:03 [pump]
bin 305 0.0 0.0 1212 0 ? SW 12:13 0:00 [portmap]
root 320 0.0 0.0 0 0 ? SW 12:13 0:00 [lockd]
root 321 0.0 0.0 0 0 ? SW 12:13 0:00 [rpciod]
root 330 0.0 0.0 1416 0 ? SW 12:13 0:00 [rpc.statd]
root 344 0.0 2.1 1104 312 ? S 12:13 0:00 /usr/sbin/apmd -p
root 395 0.0 1.1 1424 168 ? S 12:13 0:00 syslogd -m 0
root 404 0.0 0.0 1440 0 ? SW 12:13 0:00 [klogd]
nobody 418 0.0 0.3 1292 44 ? S 12:13 0:00 [identd]
daemon 432 0.0 0.7 1144 104 ? S 12:13 0:00 /usr/sbin/atd
nobody 434 0.0 0.3 1292 44 ? S 12:13 0:00 [identd]
nobody 435 0.0 0.3 1292 44 ? S 12:13 0:00 [identd]
nobody 436 0.0 0.3 1292 44 ? S 12:13 0:00 [identd]
nobody 438 0.0 0.3 1292 44 ? S 12:13 0:00 [identd]
root 450 0.0 1.3 1328 188 ? S 12:13 0:00 crond
root 468 0.0 2.4 1156 356 ? S 12:13 0:00 inetd
root 482 0.0 0.0 1204 0 ? SW 12:13 0:00 [lpd]
root 526 0.0 1.9 2144 276 ? S 12:13 0:00 sendmail: accepti
root 541 0.0 0.0 1144 0 ? SW 12:13 0:00 [gpm]
root 555 0.0 0.3 6132 56 ? S 12:13 0:01 httpd
parrabal 598 0.0 15.2 6312 2204 ? S 12:13 0:00 httpd
parrabal 599 0.0 0.0 6228 0 ? SW 12:13 0:00 [httpd]
parrabal 600 0.0 13.7 6296 1980 ? S 12:13 0:00 httpd
parrabal 601 0.0 12.7 6296 1840 ? S 12:13 0:00 httpd
parrabal 602 0.0 4.0 6228 588 ? S 12:13 0:00 httpd
parrabal 603 0.0 10.0 6264 1452 ? S 12:13 0:00 httpd
parrabal 604 0.0 0.0 6228 0 ? SW 12:13 0:00 [httpd]
parrabal 605 0.0 12.1 6332 1748 ? S 12:13 0:00 httpd
xfs 615 0.0 0.4 1728 60 ? S 12:13 0:00 xfs -droppriv -da
root 657 0.0 0.0 2224 0 tty1 SW 12:13 0:00 [login]
root 658 0.0 0.0 1092 0 tty2 SW 12:13 0:00 [mingetty]
root 659 0.0 0.0 1092 0 tty3 SW 12:13 0:00 [mingetty]
root 660 0.0 0.0 1092 0 tty4 SW 12:13 0:00 [mingetty]
root 661 0.0 0.0 1092 0 tty5 SW 12:13 0:00 [mingetty]
root 662 0.0 0.0 1092 0 tty6 SW 12:13 0:00 [mingetty]
root 665 0.0 1.7 1716 256 tty1 S 12:14 0:00 -bash
root 762 0.0 0.0 2152 0 tty1 SW 12:17 0:00 [su]
parrabal 763 0.0 3.1 1708 448 tty1 S 12:17 0:00 bash
root 825 0.0 5.6 1660 812 ? S 12:27 0:00 sh ./bin/safe_mys
root 837 0.0 7.6 10948 1108 ? SN 12:27 0:00 /home/parrabal/my
root 839 0.0 7.6 10948 1108 ? SN 12:27 0:00 /home/parrabal/my
root 840 0.0 7.6 10948 1108 ? SN 12:27 0:00 /home/parrabal/my
root 910 0.0 4.8 1464 696 ? S 14:03 0:00 in.telnetd
parrabal 912 0.0 5.6 2496 808 tty1 R 14:04 0:00 ps -aux
mairving posted this at 00:50 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
If you notice on this line, the safe_mysqld script is already running. It doesn't look right though. Let's try killing it by kill 825, then try running the configure script again.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 02:07 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
The errors went away with ./configure, but when I do safe_mysqld & to start it, it starts it, then stops right away.
Says:
Mysqld started
next line:
Mysqld ended.
then i get a blank command line.
Any Idea?
mairving posted this at 02:52 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
After ./configure did you run the make and then the make install.
A couple of other things to clarify that can be a bit confusing. Once you start mysql with the safe_mysqld script, you really won't see anything dramatic. All it does is allow you to make connections to a database. Look again in ps aux | less and see if you see the daemon, not the script running. If you do try connecting to mysql.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 04:54 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
Yes I did try make and make install afterwards, and got the same error.
[msqld] is running when i do ps -aux
When I run a script containing
mysql_connect()
it gives me an error saying its an undefined funtion.
Thanks so much for your help so far.
mairving posted this at 11:24 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
Try connecting like this:
mysql
or
/usr/local/mysql/bin/mysql
nike_guy_man posted this at 15:20 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
Ok...
I did /usr/local/mysql/bin/mysql but i got an error:
Error:2002: Can't connect to local MySQL server at socket '/tmp/mysql.sock' (111)
Have you seen that before?
One of the pages you sent me had something about that, but that didn't work when I tried it.
We seem to be getting somewhere now.
mairving posted this at 15:50 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
That's an easy one. It is trying to write to your tmp directory and tmp is owned by root. You have a couple of options. One you can chown mysql /tmp. This will allow mysql to write to that directory. There are other options like this on mysql's site:
You don't have write access to `/tmp'
If you don't have write access to create a socket file at the default place (in `/tmp') or permission to create temporary files in `/tmp,' you will get an error when running mysql_install_db or when starting or using mysqld. You can specify a different socket and temporary directory as follows:
shell> TMPDIR=/some_tmp_dir/
shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock
shell> export TMPDIR MYSQL_UNIX_PORT
`some_tmp_dir' should be the path to some directory for which you have write permission. See section A Environment Variables. After this you should be able to run mysql_install_db and start the server with these commands:
shell> scripts/mysql_install_db
shell> BINDIR/safe_mysqld &
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 17:13 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
can I use anything for "/some_tmp_dir" or do i use some_temp_dir
I tried chown mysql /tmp but it still gave me the same error, cannot connect through socket "/tmp/mysql.sock"
nike_guy_man posted this at 17:20 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
I just noticed one thing...
mysqld.sock is not located in /tmp
I can't find it anywhere
Maybe I don't have it?
Is this helpful?
mairving posted this at 17:44 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
Don't worry about not being able to find the sock file. Here is some documentation that may help.
nike_guy_man posted this at 18:05 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
I tried everything there, but I get the error that /tmp/mysql.sock does not exist
am i doing something wrong or is something wrong with my machine?
mairving posted this at 18:52 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
Nothing is wrong with your machine. You are just going to have to go through the steps again.
nike_guy_man posted this at 19:17 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
What steps?
mairving posted this at 19:56 — 22nd June 2001.
They have: 2,256 posts
Joined: Feb 2001
Start here at about step 4.16 and go forward from there. You may have to stop your mysqld daemon first.
nike_guy_man posted this at 20:33 — 22nd June 2001.
They have: 840 posts
Joined: Sep 2000
ok...
I have tried versions 3.23 and 3.22 and an RPM
I want to uninstall all of them and start over.
How do I remove them and everything they have done?
Thanks
mairving posted this at 02:02 — 23rd June 2001.
They have: 2,256 posts
Joined: Feb 2001
Your answer to everything should not be to uninstall and re-install. Mysql is installed, but for some reason it is refusing a connection. You just have to be patient and go over the steps again to make sure nothing was left out.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 03:25 — 23rd June 2001.
They have: 840 posts
Joined: Sep 2000
Well, with PHP uninstall and reinstall works.
I went over the steps over and over again and over again but it still isn't working.
I have 3 version installed, is there a way to get it down to just 1 version??
Thanks
mairving posted this at 18:48 — 24th June 2001.
They have: 2,256 posts
Joined: Feb 2001
Nike, don't worry about deleting anything. It could be a bit of a RedHat thing. I think that you are using RedHat 7.1, right? See if anything is installed in /var/lib/ ? This is apparently RedHat's default location for mysql.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nike_guy_man posted this at 19:39 — 24th June 2001.
They have: 840 posts
Joined: Sep 2000
Redhat 6.2...
6.2 was more stable than 7 and Perl and PHP both work now.
at /var/lib/ mysql is found, and there are 3 contents:
directory: mysql
file: parrabal.err
directory: test
if i cd mysql then ls I lots of files ending in .myd, .myi, or .frm
What are these files?
mairving posted this at 20:13 — 24th June 2001.
They have: 2,256 posts
Joined: Feb 2001
That is just part of the MYSQL data structure. You will probably see things like columns.myd, columns.myi, columns.frm. Each table should have all three.
In looking over the documentation for mysql, it appears that there is some kind of a problem with the daemon that is running. I would try doing a couple of things to get it fixed. One try doing a search on google with the error that you are getting. Go through some of the posts of people that have had similar problems and have fixed it. The other thing to try to do is to get on the mysql mailing list and see if you can get it fixed there. I seem to vaguely remember having a similar problem. It seems like chown fixed it but I could be wrong.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.