How do i execute php programs in linux?
Moderator: General Moderators
How do i execute php programs in linux?
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
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?
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.
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?
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
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?
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
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
-
marty pain
- Forum Contributor
- Posts: 105
- Joined: Thu Jun 11, 2009 5:32 am
- Location: Essex
Re: How do i execute php programs in linux?
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.get #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured).
Re: How do i execute php programs in linux?
How do i start mysql manually??
Re: How do i execute php programs in linux?
If
return nothing then MySQL daemon is not running.
Try to start it with:
If it says "command not found" then you need to install the MySQL package.
http://en.opensuse.org/MySQL
Code: Select all
pgrep mysqldTry to start it with:
Code: Select all
rcmysql starthttp://en.opensuse.org/MySQL
There are 10 types of people in this world, those who understand binary and those who don't
-
thewebhostingdir
- Forum Newbie
- Posts: 18
- Joined: Fri Jul 17, 2009 1:15 am
Re: How do i execute php programs in linux?
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.
AccuWebHosting.Com - Windows VPS Hosting
ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale | Brick7.com | TheWebHostingDir.com
ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale | Brick7.com | TheWebHostingDir.com
Re: How do i execute php programs in linux?
execute the following commands one by one in the terminal
after that, apache+php will already be installed...now put the html and php files in /var/www/ folder.sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart