Go to advanced search

by fredella
Fri Jun 08, 2018 2:50 pm
Forum: Beginners
Topic: CGI Bash script
Replies: 5
Views: 831

Re: CGI Bash script

Thank You, the code now works with following lines: if [ $ACT1 == "IN1=on" ] || [ $ACT1 == "IN1=off" ] then if [ $ACT2 == "IN2=on" ] || [ $ACT2 == "IN2=off" ] then echo "Param OK" else echo "<meta http-equiv=\"refresh\" content=\"...
by fredella
Fri Jun 08, 2018 11:51 am
Forum: Beginners
Topic: CGI Bash script
Replies: 5
Views: 831

Re: CGI Bash script

The error is:

./ciao.cgi: line 103: if[[( != IN1=on && != IN1=off)||( != IN2=on && != IN2=off)]]: command not found
by fredella
Fri Jun 08, 2018 11:30 am
Forum: Beginners
Topic: CGI Bash script
Replies: 5
Views: 831

CGI Bash script

Hello, I'm writing a Cgi script that generate a html page that run on Apache server. I want redirect the browser to a page if some parameters is not present in the url. #!/bin/bash PARAMS=`echo $QUERY_STRING | cut -d\? -f 2` ..... ACT1=`echo $PARAMS | cut -d\& -f 1` ACT2=`echo $PARAMS | cut -d\&...
by fredella
Mon May 07, 2018 7:09 am
Forum: Beginners
Topic: PHP run on Apache2 webserver calling python script not access to I/O
Replies: 7
Views: 1678

Re: PHP run on Apache2 webserver calling python script not access to I/O

Ok, now it works fine without sudo.
The PHP page must be inside /var/www/html/ directory.
Thank You
by fredella
Sun May 06, 2018 9:32 pm
Forum: Beginners
Topic: PHP run on Apache2 webserver calling python script not access to I/O
Replies: 7
Views: 1678

Re: PHP run on Apache2 webserver calling python script not access to I/O

Get your ownership, group and permissions correct and your script will run
How to permit to user `www-data' to call python script test.py located in /home/pi/Progetti/Python/test.py?
by fredella
Sun May 06, 2018 9:24 pm
Forum: Beginners
Topic: PHP run on Apache2 webserver calling python script not access to I/O
Replies: 7
Views: 1678

Re: PHP run on Apache2 webserver calling python script not access to I/O

I have moved prova.php to /var/www/html and I have move python script to external path: /home/pi/Progetti/Python/ The remapped php is the following: <?php echo "Hello World, today is "; echo date('l, F jS, Y'); echo " This line come from php"; echo '<pre>'; $message = exec("...
by fredella
Sun May 06, 2018 1:47 pm
Forum: Beginners
Topic: PHP run on Apache2 webserver calling python script not access to I/O
Replies: 7
Views: 1678

Re: PHP run on Apache2 webserver calling python script not access to I/O

I try to change:

Code: Select all

$message = exec("/var/www/script/test.py 2>&1");
with:

Code: Select all

$message = exec("sudo /var/www/script/test.py 2>&1");
and now the error is:

sudo: no tty present and no askpass program specified
by fredella
Sun May 06, 2018 12:28 pm
Forum: Beginners
Topic: PHP run on Apache2 webserver calling python script not access to I/O
Replies: 7
Views: 1678

PHP run on Apache2 webserver calling python script not access to I/O

Hello, I have write a python script that use RPi.GPIO library to manage the I/O. When I call the script from Geany or from terminal by file manager works fine. If I call the script from PHP page I receive the following message: RuntimeError: No access to /dev/mem. Try running as root! PHP code is: <...
by fredella
Fri Apr 13, 2018 8:46 pm
Forum: Beginners
Topic: Connect to MariaDB from C code.
Replies: 5
Views: 6491

Re: Connect to MariaDB from C code.

Thank You, now I can compile the file!
by fredella
Fri Apr 13, 2018 2:26 pm
Forum: Beginners
Topic: Connect to MariaDB from C code.
Replies: 5
Views: 6491

Re: Connect to MariaDB from C code.

Thank for You, I have installed libmariadb-dev-compat package. I have found the correct path of Mysql.h find /usr/ -name 'mysql.h' /usr/include/mariadb/mysql.h Then I try to compile with this command: root@raspberrypi:/home/pi# gcc -I/usr/include/mariadb/ test02.c /tmp/ccULTCjW.o: In function `finis...
by fredella
Thu Apr 12, 2018 10:58 pm
Forum: Beginners
Topic: Connect to MariaDB from C code.
Replies: 5
Views: 6491

Connect to MariaDB from C code.

Hi, I have a maria db that works perfectly. I can use the db with a connection from a Windows 10 pc through a visual client or through visual studio C# program. From windows, I can use the same procedures like for mysql db and I can add, delete, table, view or simply add record. Now I would like to ...

Go to advanced search