Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cups web server #5940

Open
markosjal opened this issue Aug 2, 2021 · 8 comments
Open

Cups web server #5940

markosjal opened this issue Aug 2, 2021 · 8 comments
Assignees
Labels
question General usage question

Comments

@markosjal
Copy link

I was wondering if it is possible to get the CUPS web interface linux to run php . I ask this because it is installed and already running . I would like to work in additional printer and scanning related functionality through that web interface. It also makes perfect sense that it be integrated into the same interface.

@michaelrsweet
Copy link
Collaborator

@markosjal Yes, it is possible. Look at the http:https://localhost:631/help/cgi.html documentation on setting this up.

@michaelrsweet michaelrsweet self-assigned this Aug 3, 2021
@michaelrsweet michaelrsweet added the question General usage question label Aug 3, 2021
@markosjal
Copy link
Author

markosjal commented Aug 3, 2021

Not quite so easy. I followed the instructions and after a cups restart PHP code is displayed on page .

So I made sure php was installed , but do not think I need it???

Now after full system restart the phpinfo.php page i created downloads in browser

PHP is not processed

Using Linux Mint 20.1 Ulyssa (based on Ubuntu 20.04) and CUPS from repos

@michaelrsweet
Copy link
Collaborator

@markosjal Depending on the version of CUPS you are using, you might also need to make sure the execute bit (chmod +x filename.php) is set.

@markosjal
Copy link
Author

set phpinfo.php with execution bit chmod +x owner is root:root just like the other files there no PHP scripts are executed. Instead. phpinfo.php is downloaded.

There is something missing in the docs to get this working

@michaelrsweet
Copy link
Collaborator

@markosjal Can you attach the PHP file you are using?

@michaelrsweet michaelrsweet reopened this Sep 5, 2021
@jschwender
Copy link
Contributor

jschwender commented Sep 9, 2021

The funtionality is compile time dependent, in 2018 libcupscgi1 was removed and is not packages anymore in ubuntu and think in debian too. I am really not sure what that means, could it be that it is unavailable since version 2.2.9?? Can anyone confirm that it is working in other distros or Macos?

@michaelrsweet
Copy link
Collaborator

@jschwender The CGI support was simplified in CUPS 2.0, but unfortunately the documentation hasn't been updated.

All that is required is to create a MIME .types file (call it cgi.types) in /etc/cups and then list the extensions you use, e.g.:

application/x-httpd-cgi cgi php

will allow any executable file in the document root with the extensions "cgi" or "php" to be run as a CGI script. You also need the #! line to tell the system which interpreter to use, e.g.:

#!/usr/php -fn
<?php
...
?>

Anyways, I am in the process of updating the documentation and adding some explicit tests to the CUPS sources so this works as expected.

@michaelrsweet
Copy link
Collaborator

Documentation changes and examples added to Apple CUPS:

[master d03753f] Update CGI documentation and add testable examples for CGI support (Issue #5940)

and OpenPrinting CUPS:

[master 3318d9f4f] Update CGI documentation and add testable examples for CGI support (Apple #5940)

@markosjal Please let me know if these examples help you get your PHP scripts to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General usage question
Projects
None yet
Development

No branches or pull requests

3 participants