Hello!
I am new to Julia and I am learning this language. When I try to open my webpage based on Julia (index.jl), I receive an error: “couldn’t create child process: 720002: index.jl”
My code for index.jl is:
#!:"C:\Program Files\Julia-1.8.5\bin\julia.exe"
using HTTP
using MySQL
function handle_request()
conn = MySQL.connect("localhost", "root", "", "search")
if !MySQL.connected(conn)
error("Nieudane połączenie z bazą danych: $(MySQL.errmsg(conn))")
end
if haskey(ENV, "QUERY_STRING")
suggestion = parse(Int, split(ENV["QUERY_STRING"], "=")[2])
suggestions = split(suggestion, ", ")
for s in suggestions
sql = "INSERT INTO suggestions (suggestion) VALUES ('$s')"
if MySQL.execute(conn, sql)
println("Nowa podpowiedź została dodana do wyszukiwarki")
else
error("Błąd: $sql $(MySQL.errmsg(conn))")
end
end
end
if haskey(ENV, "link") && haskey(ENV, "title") && haskey(ENV, "tags") && haskey(ENV, "description")
link = ENV["link"]
title = ENV["title"]
tags = ENV["tags"]
description = ENV["description"]
sql = "INSERT INTO results (url, title, description, keywords) VALUES ('$link', '$title', '$description', '$tags')"
if MySQL.execute(conn, sql)
println("Nowy rekord został dodany do wyszukiwarki")
else
error("Błąd: $sql $(MySQL.errmsg(conn))")
end
end
MySQL.close(conn)
println("Content-Type: text/html")
println()
println("""<!DOCTYPE html>
<html>
<head>
<title>Dodaj podpowiedź do wyszukiwania lub wynik wyszukiwania</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
</head>
<body>
<center><h2 style="color:blue;">Dodaj podpowiedź do wyszukiwania lub wynik wyszukiwania</h2></center>
<form method="post">
Sugestia wyszukiwania: <input type="text" name="suggestion"><br>
<input type="submit" value="Dodaj podpowiedź">
</form>
<br>
<hr>
<form method="post">
Link do strony: <input type="text" name="link"><br>
Tytuł strony: <input type="text" name="title"><br>
Słowa kluczowe: <input type="text" name="tags"><br>
Krótki opis strony: <input type="text" name="description"><br>
<input type="submit" value="Dodaj wynik">
</form>
</body>
</html>
""")
end
Server is XAMPP in Windows, also I have installed Julia on my PC with PATH variable, also installed HTTP and MySQL packages, and added Julia interpreter to httpd.conf file
AddHandler cgi-script .jl
ScriptInterpreterSource Registry-Strict
ScriptAlias "/submit-searchon/" "S:/Server/mini/public_html/dropnetwork.zu/submit-searchon/"
AddHandler cgi-script .jl
Error from Apache error.log:
[Wed Mar 08 22:52:45.067556 2023] [cgi:error] [pid 1564:tid 1536] (OS 2)Nie można odnaleźć określonego pliku. : [client 192.168.1.167:64342] couldn't create child process: 720002: index.jl
[Wed Mar 08 22:52:45.067556 2023] [cgi:error] [pid 1564:tid 1536] (OS 2)Nie można odnaleźć określonego pliku. : [client 192.168.1.167:64342] AH01223: couldn't spawn child process: S:/Server/mini/public_html/dropnetwork.zu/submit-searchon/index.jl
What’s the problem of running this file in browser? When I run it directly from Julia, there is no problem.