Page 1 of 1

How do i execute php programs in linux?

Posted: Sun Jun 28, 2009 12:04 am
by sanjith
Hi All,
I'm a fresher in php programming and linux.

With Windows, this is what i do. I start the WAMP server and store my php files under c:\wamp\www\Sanjith. And when i go to http://localhost, i get the list of php programs and can run any one of them.

But i dont know how to do something similar in linux.

In linux, I installed and started apache and mysql. Edited the /srv/www/htdocs/index.html file and went to http://localhost to confirm if it was working. And it was. The contents of index.html was shown. But I was wondering.... where do i have to place my php programs so that i can access them from localhost??

I dont know where to store my php programs so that they can be accessed. As in windows, I hope i would be able to access them from localhost itself.

Please help.

With Regards
Sanjith

Re: How do i execute php programs in linux?

Posted: Sun Jun 28, 2009 1:39 am
by Doug G
In Fedora 9 you'll find your httpd.conf file in /etc and in that file you'll see where your document root is and where any virtual hosts may be too.

Without any changes, out of the box Fedora the root of your web files is /var/www/html/ You can add <Directory> and/or <Alias> directives to locate files elsewhere in the filesystem if you wish.

Re: How do i execute php programs in linux?

Posted: Sun Jun 28, 2009 2:04 am
by wpsd2006
which linux distribution you use ?

in ubuntu it's in the /var/www/
centos /var/www/html/
other i don't know

I'm not sure whether you can change this directory or not
apache should be able to do it

don't forget to install php first

Re: How do i execute php programs in linux?

Posted: Sun Jun 28, 2009 8:59 am
by sanjith
I'm using opensuse11.1.
Currently I'm accessing the files by placing them under /home/sanjith/public_html/<myapps>/
And then typing http://localhost/~sanjith/ in the browser.

Now there seems to be another problem.

I am not able to login to my phpMyAdmin. The root user password is blank and when i try to login, I get #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured).

What should i do??

Regards
Sanjith

Re: How do i execute php programs in linux?

Posted: Mon Jun 29, 2009 9:20 am
by marty pain
get #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured).
I had this when I first started. It's probably because MySQL isn't running. Some Linux distros don't start MySQL on boot. Start MySQL manually and then try phpMyAdmin. If that works then add MySQL to start up.

Re: How do i execute php programs in linux?

Posted: Tue Jun 30, 2009 12:13 am
by sanjith
How do i start mysql manually??

Re: How do i execute php programs in linux?

Posted: Tue Jun 30, 2009 12:51 am
by VladSun
If

Code: Select all

pgrep mysqld
return nothing then MySQL daemon is not running.
Try to start it with:

Code: Select all

rcmysql start
If it says "command not found" then you need to install the MySQL package.

http://en.opensuse.org/MySQL

Re: How do i execute php programs in linux?

Posted: Fri Aug 14, 2009 5:25 pm
by thewebhostingdir
sanjith wrote:I'm using opensuse11.1.
Currently I'm accessing the files by placing them under /home/sanjith/public_html/<myapps>/
And then typing http://localhost/~sanjith/ in the browser.

Now there seems to be another problem.

I am not able to login to my phpMyAdmin. The root user password is blank and when i try to login, I get #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured).

What should i do??

Regards
Sanjith

Yes, you need to restart MySQL. In windows, I hope you know, we can restart it from the small icon in toolbars.

Re: How do i execute php programs in linux?

Posted: Fri Sep 11, 2009 6:34 pm
by lipun4u
execute the following commands one by one in the terminal
sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart
after that, apache+php will already be installed...now put the html and php files in /var/www/ folder.