PHP - Moved: An Effective Way To Execute Root Shell Commands?
This topic has been moved to Linux.
http://www.phpfreaks.com/forums/index.php?topic=333614.0 Similar TutorialsI'm experimenting with the shell_exec function to gain shell capability on a Linux host that doesn't provide it otherwise. I've found that I can see what is in different directories by entering a command line like: Code: [Select] cd ..; ls but if I enter two consecutive command lines: Code: [Select] cd .. ls The cd command has no effect. Apparently shell_exec is using a new shell every time I call it. Is there a way to start a shell in a PHP script and keep it active while I pass it multiple commands, so that this won't happen? Hi guys, I am new here, and I am a bit stuck with doing something unusual. I want to create a script that can turn on a program (dynamips and dynagen). So far, I have tried 'exec' and 'shell_exec'. Soon I realized that apache runs the commands as 'www-data' user (apache2 in ubuntu) and it's very limited on what you can execute. Is there any way to do that at all? What would be the best practice? I am not concerned about security as this is not a production environment... Thanks Hi all I have this problem on a server using php5, unix based, safe_mode is On globally, i have turned it off locally through php.ini. Ok, this is testing example script i used: $cmd = ( "php -v" ); $out = shell_exec( $cmd ); print $out; On my own server this returns php version. On this mentioned server i'm using (commercial) this causes complete server breakdown, when logged in with SSH, i can't even issue "ls" command after that, nor find and kill the process. What could be so wrong with it? I don't think calling php-cli would make any difference. Hi, I am trying to create a PHP script ("repair-correct.php") in order to run some CLI commands without using PuTTy - The CLI commands are needed to repair/correct the execution of a web application named Mautic. Shared web host account with PHP 7.0 URL: https://www.myserver.com Mautic directory: https://www.myserver.com/mautic
What I want to do is:
Step1: Change ownership of files and folders To find out which user Apache is running as, I want to execute the following command and take note of the first entry in the line which is returned: ps aux | grep apache2 I want to use this information to find the groups with the following command groups apache_user (where apache_user is the user I identified from the first step above) To reset the ownership of files and folders, I want to use the following command (ensuring that I replace apache_user and apache_group with the values identified in the steps above): sudo chown -R apache_user:apache_group With this command I want to change ownership, using the -R flag which means recursively - including all files/folders within that location.
Step 2: Reset the file and folder permissions
find . -type f -not -perm 644 -exec chmod 644 {} +
Thanks so much for your help in solving this problem!
Best, Tony
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=306588.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=345200.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=309442.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=308276.0 This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=352264.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=355955.0 This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=349296.0 Please tell me how to call, getimagesize() in exec command. http://www.example.com/images!/logos/ps_logo2.png I am using the linux enviroment. If the uRL has "!" symbol, it prints event not found. Please tell me how to avoid this. I've written some code to move a bunch of mp3's from one folder on a network server, rename them...based on the day of the week and date of the month...and then put them on another folder on the original server. Here's the code Code: [Select] #!/usr/bin/php <?php $today = date('m.d.y'); $week = date('W'); $weekplus = $week + 1; $daynumber = date('w'); //$dayofweek = date('D'); if (date('D') == "Mon") { $dayofweek = "mon"; } elseif (date('D') == "Tue") { $dayofweek = "tue"; } elseif (date('D') == "Wed") { $dayofweek = "wed"; } elseif (date('D') == "Thu") { $dayofweek = "thu"; } elseif (date('D') == "Fri") { $dayofweek = "fri"; } //original filenames are in this format 10361MRS-H01T01.mp3 $file1 = "10" . "$weekplus" . "$daynumber" . "MRS-H01T01.mp3"; $file2 = "10" . "$weekplus" . "$daynumber" . "MRS-H01T02.mp3"; $file3 = "10" . "$weekplus" . "$daynumber" . "MRS-H01T03.mp3"; $file4 = "10" . "$weekplus" . "$daynumber" . "MRS-H01S01.mp3"; $file5 = "10" . "$weekplus" . "$daynumber" . "MRS-H01S02.mp3"; $file6 = "10" . "$weekplus" . "$daynumber" . "MRS-H01S03.mp3"; $file7 = "10" . "$weekplus" . "$daynumber" . "MRS-H02T01.mp3"; $file8 = "10" . "$weekplus" . "$daynumber" . "MRS-H02T02.mp3"; $file9 = "10" . "$weekplus" . "$daynumber" . "MRS-H02T03.mp3"; $file10 = "10" . "$weekplus" . "$daynumber" . "MRS-H02S01.mp3"; $file11 = "10" . "$weekplus" . "$daynumber" . "MRS-H02S02.mp3"; $file12 = "10" . "$weekplus" . "$daynumber" . "MRS-H02S03.mp3"; $file13 = "10" . "$weekplus" . "$daynumber" . "MRS-H03T01.mp3"; $file14 = "10" . "$weekplus" . "$daynumber" . "MRS-H03T02.mp3"; $file15 = "10" . "$weekplus" . "$daynumber" . "MRS-H03T03.mp3"; $file16 = "10" . "$weekplus" . "$daynumber" . "MRS-H03S01.mp3"; $file17 = "10" . "$weekplus" . "$daynumber" . "MRS-H03S02.mp3"; $file18 = "10" . "$weekplus" . "$daynumber" . "MRS-H03S03.mp3"; $file19 = "10" . "$weekplus" . "$daynumber" . "MRS-H04T01.mp3"; $file20 = "10" . "$weekplus" . "$daynumber" . "MRS-H04T02.mp3"; $file21 = "10" . "$weekplus" . "$daynumber" . "MRS-H04T03.mp3"; $file22 = "10" . "$weekplus" . "$daynumber" . "MRS-H04S01.mp3"; $file23 = "10" . "$weekplus" . "$daynumber" . "MRS-H04S02.mp3"; $file24 = "10" . "$weekplus" . "$daynumber" . "MRS-H04S03.mp3"; $deletepath = "/var/www/showdownloads/mrshow/"; exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file1' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file2' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file3' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file4' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file5' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file6' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file7' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file8' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file9' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file10' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file11' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file12' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file13' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file14' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file15' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file16' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file17' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file18' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file19' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file20' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file21' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file22' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file23' /var/www/showdownloads/mrshow/"); exec("scp 'root@192.168.2.245:/Volumes/Big\ Disk/Media\ Shooter\ downloads/Matt\ and\ Ramona\ Content\ $today/$file24' /var/www/showdownloads/mrshow/"); rename("$deletepath/$file1", "$deletepath/mr_$dayofweek-2-1.mp3"); rename("$deletepath/$file2", "$deletepath/mr_$dayofweek-2-3.mp3"); rename("$deletepath/$file3", "$deletepath/mr_$dayofweek-2-5.mp3"); rename("$deletepath/$file4", "$deletepath/mr_$dayofweek-2-2.mp3"); rename("$deletepath/$file5", "$deletepath/mr_$dayofweek-2-4.mp3"); rename("$deletepath/$file6", "$deletepath/mr_$dayofweek-2-6.mp3"); rename("$deletepath/$file7", "$deletepath/mr_$dayofweek-3-1.mp3"); rename("$deletepath/$file8", "$deletepath/mr_$dayofweek-3-3.mp3"); rename("$deletepath/$file9", "$deletepath/mr_$dayofweek-3-5.mp3"); rename("$deletepath/$file10", "$deletepath/mr_$dayofweek-3-2.mp3"); rename("$deletepath/$file11", "$deletepath/mr_$dayofweek-3-4.mp3"); rename("$deletepath/$file12", "$deletepath/mr_$dayofweek-3-6.mp3"); rename("$deletepath/$file13", "$deletepath/mr_$dayofweek-4-1.mp3"); rename("$deletepath/$file14", "$deletepath/mr_$dayofweek-4-3.mp3"); rename("$deletepath/$file15", "$deletepath/mr_$dayofweek-4-5.mp3"); rename("$deletepath/$file16", "$deletepath/mr_$dayofweek-4-2.mp3"); rename("$deletepath/$file17", "$deletepath/mr_$dayofweek-4-4.mp3"); rename("$deletepath/$file18", "$deletepath/mr_$dayofweek-4-6.mp3"); rename("$deletepath/$file19", "$deletepath/mr_$dayofweek-5-1.mp3"); rename("$deletepath/$file20", "$deletepath/mr_$dayofweek-5-3.mp3"); rename("$deletepath/$file21", "$deletepath/mr_$dayofweek-5-5.mp3"); rename("$deletepath/$file22", "$deletepath/mr_$dayofweek-5-2.mp3"); rename("$deletepath/$file23", "$deletepath/mr_$dayofweek-5-4.mp3"); rename("$deletepath/$file24", "$deletepath/mr_$dayofweek-5-6.mp3"); exec("scp '/$deletepath/mr_$dayofweek-2-1.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-2-1.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-2-2.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-2-2.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-2-3.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-2-3.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-2-4.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-2-4.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-2-5.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-2-5.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-2-6.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-2-6.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-3-1.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-3-1.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-3-2.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-3-2.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-3-3.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-3-3.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-3-4.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-3-4.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-3-5.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-3-5.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-3-6.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-3-6.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-4-1.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-4-1.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-4-2.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-4-2.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-4-3.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-4-3.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-4-4.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-4-4.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-4-5.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-4-5.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-4-6.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-4-6.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-5-1.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-5-1.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-5-2.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-5-2.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-5-3.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-5-3.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-5-4.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-5-4.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-5-5.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-5-5.mp3'"); exec("scp '/$deletepath/mr_$dayofweek-5-6.mp3' 'root@192.168.2.245:/Volumes/Big\ Disk/Show\ Downloads/mrshow/mr_$dayofweek-5-6.mp3'"); ?> The problem is, this is the only way I can get this to work. I actually want to name the files in this format Quote mr_mon_2-1.mp3 Instead of the format now Quote mr_mon-2-1.mp3 The difference being that after the three letter version of the date, I have to have a dash...I want an underscore there. If I try to rename the file to use an underscore...it doesn't use the day of the week...so it turns out to be mr_2-1.mp3 Any ideas what I'm doing wrong? Thanks. It was suggested that I add a ‘report’ parameter to the code, after revising with the ‘scale2ref’ code which appears to prevent the video from uploading/proceeding: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "[0]scale=426:-2[vid];[1][vid]scale2ref='oh*mdar':'ih/10'[wm][vid];[vid][wm]overlay=5:5:format=rgb,format=yuv420p" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 -report'.$video_output_full_path_240.' 2>&1'; $shell = shell_exec($ffmpegCommand); I couldn’t see where the -report parameter was supposed to output (error.log has a filesize of 0). So I was asked to “run command from the shell and check”? But, I’m not sure what command and where/how to do that. I tried adding this to the php code, and attempted to upload again, same result echo shell_exec("/usr/local/bin/ffmpeg -report log.txt 2>&1");
any additional help is appreciated
Hello, I am developing an account manager for our local network and I want people to be able to login to my website and change their UNIX & Mailbox password. These people have SSH access so that is why the UNIX passwd should also be changed. So what I want to do is get the values $username, $currentpwd , $newpwd and $newpwdcnfrm from the HTML form and execute the following shell commands : Quote su -l $username passwd Enter current UNIX Passwd : $currentpwd Enter new UNIX Passwd : $newpwd Confirm UNIX Passwd : $newpwdcnfrm The problem here is, passwd takes old and new passwords as input, not as command parameters. So I cant just do shell_exec("passwd $currentpwd $newpwd $newpwdcnfrm") ; Do you guys know how to give input to the command? thanks. Btw : Please do not argue about the security issues. I am aware of everything and I am perfectly sure that the script will run securely. Hello, If we have large amount of data we always use SCP to copy data from remote server. scp -P 100 user@192.168.2.3: /home/user/folder /home/user1/folder/. But if DSL (Internet) of local computer disconnects I observed failure of transfer many times and this whole process becomes irritating. Is there any alternative way to use scp or rsync with php so that we can execute it with script ? Something like this ? <?php // Having shell access but its not working 4 me... $conn = ssh2_connect('ftp.server.com', 100); ssh2_auth_password($conn 'user', 'pass'); ssh2_scp_send($conn, '/local/filename', '/remote/filename', 0644); ?> Another question is there any way we can run such code with the help of shell_exec() or is this implementation is secure? Thanks in Advance! Hi, I recently updraded PHP to 5.3.3 and Apache to 2.2.17 on a Linux Centos 5.4 Box using yum. Since then the Web pages running under Apache cannot connect to the database using mysql. If I run a manual PHP script, I am able to. When I run phpinfo() on PHP under Apache I get this (note: --without-mysql): './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--without-sqlite3' '--disable-phar' '--disable-fileinfo' '--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' When I run phpinfo() on PHP that I run manually from the shell: ('--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config') './configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-mime-magic' '--without-sqlite' '--without-sqlite3' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--enable-force-cgi-redirect' '--enable-pcntl' '--with-imap=shared' '--with-imap-ssl' '--enable-mbstring=shared' '--enable-mbregex' '--with-gd=shared' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-mysql=shared,/usr' '--with-mysqli=shared,/usr/bin/mysql_config' '--enable-dom=shared' '--with-pgsql=shared' '--enable-wddx=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--with-xsl=shared,/usr' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--with-curl=shared,/usr' '--enable-fastcgi' '--enable-pdo=shared' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-mysql=shared,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pdo-dblib=shared,/usr' '--enable-json=shared' '--enable-zip=shared' '--with-readline' '--with-pspell=shared' '--enable-phar=shared' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-mssql=shared,/usr' '--enable-sysvmsg=shared' '--enable-sysvshm=shared' '--enable-sysvsem=shared' '--enable-posix=shared' '--with-unixODBC=shared,/usr' '--enable-fileinfo=shared' '--enable-intl=shared' '--with-icu-dir=/usr' '--with-recode=shared,/usr' Both phpinfo() show PHP 5.3.3 how can I configure PHP under Apache? Do I need to rebuild / reintall Apache manually? Thanks very much! Frank Hello dear friends, i've very simple php script for my website and it has feature that visitor can register and upload image for own profile. somone has uploaded PHP Shell as image and succeed to control on my website using that shell. so the problem is in uploading image can pass any file so can someone please help me how how to prevent it and here are the codes of image upload form and function. * Image upload form code Code: [Select] <form action="profile.php" method="post" enctype="multipart/form-data" name="form" id="form"> My Picture : <input name="userpic" type="file" id="userpic"/> <input type="submit" name="Submit" value="Update"/> * Profile.php code (it rename the image by add time to its name then put the image in path /users/ then insert the new name of the image into the database table) $ImageName = $_FILES[userpic][name]; // Get the image $t = time(); // Get Time $NewImageName = "$t$ImageName"; // New name copy($_FILES[userpic][tmp_name], "users/$NewImageName"); $sql= "update users SET userpic='$NewImageName'"; How then i can stop they upload shell thanks I'm trying to get a php script working to download the latest CNN news podcast each hour. CNN names the file based on the year, month, day, and time. Here's what I'm trying: Code: [Select] <?php $year = date('Y'); $month = date('m'); $day = date('d'); $now = date('Y-m-d-h'); $hour = date('gA'); $hourplus1 = ($hour + 1); $hourminus1 = ($hour - 1); $ampm = date('A'); $url = "http://podcasts.cnn.net/cnn/services/podcasting/newscast/" . "audio/" . "$year" . "/" . "$month" . "/" . "$day" . "/CNN-News-" . "$month" . "-" . "$day" . "-" . "$year" . "-" . "$hourplus1" . "$ampm" . ".mp3"; echo $url; echo system('wget "$url"'); ?> When running from the shell, I get an "http://: invalid hostname" error. The echo of $url looks right...but it won't run from shell. Any ideas? For those not knowing about this, is a new security hole found in all linux/unix based operating systems that should be patched.
http://arstechnica.c...with-nix-in-it/
|