PHP - failed opening required

Note, This is an external script not running on InfinityFree, if it’s in the wrong category, I’ll move it, The operating system is Ubuntu 18.04, PHP 7.2, Apache2

So, I have this script called make-cert.php, it has the following content;

<?php  
  $data = array(
      "certificate_domains" => "$_GET['domains']",
      "certificate_csr" => "$_GET['csr']",
      "certificate_validity_days" => "90"
  );
    
  $post_data = json_encode($data);
    
  $crl = curl_init('https://api.zerossl.com/certificates?access_key=xxxx');
  curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($crl, CURLINFO_HEADER_OUT, true);
  curl_setopt($crl, CURLOPT_POST, true);
  curl_setopt($crl, CURLOPT_POSTFIELDS, $post_data);
  curl_setopt($crl, CURLOPT_HTTPHEADER, array(
      'Content-Length: ' . strlen($payload))
  );
    
  $result = curl_exec($crl);
    
  if ($result === false) {
      $result_noti = 0; die();
  } else {
 
      $result_noti = 1; die();
  }
  curl_close($crl);
    
?>

And everytime I run it, I get 500 error, and the server log says:

PHP Fatal error:  Unknown: Failed opening required '/var/www/hn.fyi/ssl/src/make-cert.php' (include_path='.:/usr/share/php') in Unknown on line 0

include_path in php.ini is commented out.

I checked the PHP.ini file, and auto_prepend_file is empty, And other PHP code works on the same domain, document root & webserver.

What is going on?

Maybe this:

3 Likes

Do you open this make-cert.php script directly from your web browser? Or is this supposed to be a standardized module you’re including in a website handling script?

Directly accessed, As in hn.fyi/ssl/make-cert.php?domains=xxx&csr=xxx

Interesting. If the web URL is hn.fyi/ssl/make-cert.php, why does the error show hn.fyi/ssl/src/make-cert.php? Where does the src part come from?

Are there any .htaccess rules or Apache config changes which mess with how these files and folders are routed?

1 Like

Oh sorry, i completely forgot about that, it is hn.fyi/ssl/src/make-cert.php (https://www.hn.fyi/ssl/src/make-cert.php)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.