Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 3rd July 2009, 07:46
AnilKumar AnilKumar is offline
Junior Member
 
Join Date: Sep 2008
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to AnilKumar
Default How to run shell_exex command at web site using php code.

Hello,

Can anyone suggest how to overcome from this one.

Shell_exec is perfectly run in the localhost,
when i want to run that command at the web server, that is not executed.

chmod 7777 -R \public\test\sleepingbaby.jpg

presently that file has 0644 permission.

i want to change that file permission to full access that is 7777.

$cmd = "chmod 7777 -R \public\test\sleepingbaby.jpg";
$res=shell_exec ($cmd);
when i echo $res; then that not return any values.


Please give any solution for it.

Anil Kumar.
http://www.anil2u.info

Last edited by AnilKumar; 15th April 2010 at 18:34.
Reply With Quote
The Following User Says Thank You to AnilKumar For This Useful Post:
ffs123 (4th November 2011)
Sponsored Links
  #2  
Old 3rd July 2009, 14:41
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 237
Thanks: 2
Thanked 22 Times in 22 Posts
Default

Is that file owned by the user the webserver is running as? Also, you don't needt omake jpgs executable - 644 is proper permissions...
Reply With Quote
  #3  
Old 3rd July 2009, 23:00
Leszek Leszek is offline
Senior Member
 
Join Date: Nov 2006
Location: Poland,Włocławek
Posts: 369
Thanks: 22
Thanked 41 Times in 35 Posts
Send a message via Skype™ to Leszek
Default

Also check if shell_exec isn't blocked in php.ini.
Reply With Quote
The Following User Says Thank You to Leszek For This Useful Post:
ffs123 (4th November 2011)
  #4  
Old 4th November 2011, 11:31
ffs123 ffs123 is offline
Junior Member
 
Join Date: Oct 2011
Posts: 5
Thanks: 9
Thanked 1 Time in 1 Post
Cool shell_exec cannot run under website apache user

I have same problem

I install imagemagic at server.
and I can run

convert test.pdf[0] test.jpg and runs fine. and get screen shot of the first pdf file.

login as: root
root@x.xx.xx.xxx's password:
Last login: Wed Nov 2 15:55:35 2011 from 184.18.153.10
[root@server11 ~]# convert -density 300 -quality 100 /var/www/clients/client1/web1/a.pdf[0] /var/www/clients/client1/web1/test1.jpg

Or
convert -density 300 -quality 100 /var/www/clients/client1/web1/a.pdf[0] /var/www/clients/client1/web1/test1.jpg



I cannot run under website with php
I tested in my other cpanel server and works fine. But not ISPCONFIG.
shell_exec function is enabled in php.ini

e.g sample php command

if($file_type == "pdf")
{
shell_exec("convert -density 300 -quality 100 /var/www/clients/client1/web1/web/files/test.pdf[0]
"/var/www/clients/client1/web1/web/thumbs/test.jpg 2>&1");
Reply With Quote
  #5  
Old 5th November 2011, 12:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

Are open_basedir restrictions active? If so, you should add the directory where convert is located to the open_basedir directories (on the Options tab of the website in ISPConfig).
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #6  
Old 7th November 2011, 09:59
nbhadauria nbhadauria is offline
Member
 
Join Date: Aug 2010
Location: New Delhi, India
Posts: 79
Thanks: 1
Thanked 13 Times in 13 Posts
Send a message via Skype™ to nbhadauria
 
Default

Check that apache user can execute command chmod.

Also check apache logs for errors..

You might need to give sudo permission to apache for command chmod.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 13:06
Really Simple DNS Question andysm849 Server Operation 4 20th October 2008 23:32
network issues now it says "401 The web site is blocked by administrator" Check General 3 26th February 2008 14:22
Sites are up, but none show in ispconfig Check Installation/Configuration 10 5th February 2008 11:33
Power failiure Wwamphyri General 6 24th February 2007 21:21


All times are GMT +2. The time now is 14:54.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.