Visit Our UNIX and Linux User Community

calling a php file from perl script..

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calling a php file from perl script..
# 1  
Old 06-10-2011
calling a php file from perl script..

Hi am new to perl script ..
i need some useful tutorials links to learn perl script..
and a sample script to call a php file from perl script..

# 2  
Old 06-10-2011
You can use any of the examples below
exec('scriptname.php'); # execute the script then exit
system('scriptname.php'); # Fork and wait while the child executes the script
my $output=`scriptname.php` # Fork and wait while the child executes the script then set the contents of $output to the output of the script

# 3  
Old 06-11-2011
perl execution..

thanks ..
i used the function but dono whether my script is correct or not..

my perl script..

my sample php file..
echo "testing";

the result after executing my perl script...
/d01/user/sample.php: line 1: ?php: No such file or directory
/d01/user/sample.php: line 3: syntax error near unexpected token `newline'
/d01/user/sample.php: line 3: `?>'

can u guide me where am i going wrong...

Last edited by Scott; 06-11-2011 at 08:25 AM.. Reason: Code tags
# 4  
Old 06-11-2011

Either try changing the call to the script to tell it to use PHP (i.e. 'php /d01/user/sample.php'), or add a "shebang" to the PHP script:


Previous Thread | Next Thread
Test Your Knowledge in Computers #727
Difficulty: Medium
Radia Perlman Invented the Spanning Tree Protocol (STP).
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script for Calling a function and writing all its contents to a file

I have a function which does awk proceessing sub mergeDescription { system (q@awk -F'~' ' NR == FNR { A = $1 B = $2 C = $0 next } { n = split ( C, V, "~" ) if... (3 Replies)
Discussion started by: crypto87
3 Replies

2. Shell Programming and Scripting

Calling perl from shell script

I am calling a perl script from shell script. $ cat mah_appln_bkp_oln.ksh #!/bin/ksh . /udb/home/udbappln/.profile . /udb/home/udbappln/sqllib/db2profile Com=/udb/udbappln/utility/systemscripts/currentUMR perl $Com/ -d dbname --tsm --purgetsmcopies 21 --purgetsmlogs exit 0 ... (1 Reply)
Discussion started by: ilugopal
1 Replies

3. Shell Programming and Scripting

calling a shell script present on another server using perl script.

Hi, I am working on a sever A. I want to write a perl script to execute a shell script persent on the server B. please help me in this. thanks in advance. (3 Replies)
Discussion started by: anandgodse
3 Replies

4. Shell Programming and Scripting

Help needed in calling path file from Perl script.

Hi All, I need help in accessing a path file (path.xyz_pqr) not having a shell shebang and exporting paths in the following syntax, export DB_SCRIPT_PATH="/abc/aash/scripts/db_scripts/xyz_pqr" export SRC_FILES_DIR="/bcd/fdw/incoming/xyz_pqr" I need to use the path contained in the... (8 Replies)
Discussion started by: xtatic
8 Replies

5. Shell Programming and Scripting

How we can pass the argument when calling shell script from perl script

Can someone let me know how could I achieve this In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

6. Shell Programming and Scripting

calling a perl script with arguments from a parent perl script

I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard. From $input1=123; $input2=abc; I tried calling it with system("/usr/bin/perl $input1 $input2"); and `perl... (1 Reply)
Discussion started by: grajp002
1 Replies

7. Shell Programming and Scripting

Calling a Perl script in a Bash script -Odd Situation

I am creating a startup script for an application. This application's startup script is in bash. It will also need to call a perl script (which I will not be able to modify) for the application environment prior to calling the application. The problem is that this perl script creates a new shell... (5 Replies)
Discussion started by: leepet01
5 Replies

8. Shell Programming and Scripting

Calling 3 perl script from one

hi all, I have 3 perl scripts, and each of these work when i pass a date for eg: perl 2010-05-27 now i want to write a perl script that would call the 3 scripts and make it run all the 3 scripts (,, parallelly rather than 1 after the other....... pls... (2 Replies)
Discussion started by: siva_nagarajan
2 Replies

9. Shell Programming and Scripting

Calling Expect script in Perl...

I call a EXPECT script from my perl script with machine IP and a FIle. The script logins to the machine and exports the value. The values to be exported or stored in a file. I have close to 10 machines and I have created 10 files and pass the corresponding files in command line, Now I could like... (4 Replies)
Discussion started by: ramkriz
4 Replies

10. Shell Programming and Scripting

Calling Winzip from perl script

Hi, I would like to invoke "Winzip" utility from a perl script, input the name of zip file and provide output path for unzipped files. Any pointers will be appreciated. Thanks (5 Replies)
Discussion started by: MobileUser
5 Replies

Featured Tech Videos