Perl in Xampp

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Perl in Xampp

Postby chalancito » 15. December 2020 23:45

ok,
I installed XAMPP, configurated my VirualHosts... until now all is working: Apache->PHP->MySQL(Mariadb), also my virtualhosts.
Now i want to run my Perl scripts but I don't know where to put them (Directory) in order to use my DBs from my Perl scripts.
Please give me the some orientation about this. Thanks in advance.
chalancito
 
Posts: 9
Joined: 29. August 2017 17:47
XAMPP version: xampp-linux-x64-7.4.6-0
Operating System: Ubuntu 18.04

Re: Perl in Xampp

Postby Altrea » 16. December 2020 00:33

You can place your perl scripts in any by Apache requestable folder you want.

Some examples:
/opt/lampp/cgi-bin/
/opt/lampp/htdocs/projectxy/
/opt/lampp/vhosts/vhost1/

If you want to place them inside your virtual host and the virtual host is not a subdirectory of htdocs, then you need to add the Directory Option ExecCGI by yourself.
For cgi-bin and htdocs this is already given in the default configuration of XAMPPs Apache.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Perl in Xampp

Postby chalancito » 16. December 2020 01:29

Thank you very much. I'll proceed. My virtual hosts are inside htdocs then all must be running smoothly.
chalancito
 
Posts: 9
Joined: 29. August 2017 17:47
XAMPP version: xampp-linux-x64-7.4.6-0
Operating System: Ubuntu 18.04

Re: Perl in Xampp

Postby chalancito » 03. January 2021 02:11

ok, after trying a script of my own i got many errors, then i went to the basics and got an example from internet.
First I got an error:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC...
then i found a tip about adding a use lib with the route to the DBD/mysql and got this error:
install_driver(mysql) failed: Attempt to reload DBD/mysql.pm aborted. Compilation failed in require at (eval 15) line 3. at /opt/lampp/htdocs/dummy2/ejbdcon1.pl line 15.
the script i try to get working is just this:
#!/usr/bin/perl
use strict;
use warnings;
use lib '/usr/lib/x86_64-linux-gnu/perl5/5.30/';
use DBI;
print "Perl MySQL Connect Demo\n";
# MySQL database configuration
my $dsn = "DBI:mysql:bd_nfl";
my $username = "root";
my $password = '';
# connect to MySQL database
my %attr = ( PrintError=>0, RaiseError=>1);
# turn off error reporting via warn()
# turn on error reporting via die()
my $dbh = DBI->connect($dsn,$username,$password, \%attr);
print "Connected to the MySQL database.\n";

I don't know now how to go ahead, your tips will be appreciated
chalancito
 
Posts: 9
Joined: 29. August 2017 17:47
XAMPP version: xampp-linux-x64-7.4.6-0
Operating System: Ubuntu 18.04

Re: Perl in Xampp

Postby okaybmd » 10. March 2023 15:23

XAMPP is now using MariaDb instead of MySQL, so you need to use:
my $dsn = "DBI:MariaDB:...
okaybmd
 
Posts: 1
Joined: 10. March 2023 15:03
XAMPP version: 3.3.0
Operating System: Ubuntu


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 18 guests