I am having some problems in running cgi on my Apache (Windows, XAMPP), but the exe runs smoothly on the command prompt.
Reading the logs on Apache folder it gives no information about the error. Any ideas about this?
You are a little light on the detail, so I'll just hazzard a guess.
chmod +x app_executable
Also make sure you are outputting the Content-Type: text/html (or whatever you are returning) followed by two newlines.
Is the file in the proper directory? Does Apache have the desired file/directory access rights to that directory? Can you run other CGI scripts from the same directory?
Weird.
I found the problem, it was in a
sprintf("%f", f);
where f wasn't initiated.
This is weird, because it ran normal on my cmd but not on apache
any clues?
Related
We had PMwiki installed in a few directories under public_html running on our old CentOS6 server.
The home directories were on a file system (RAID) separate from the system, so they were not affected by the installation of CentOS7 from scratch.
Now the 'normal' pages under public_html are accessible, php works (version 7 instead of 5), mysql works, but when i point the browser to one of the pmwiki-pages nothing is displayed, not even an error message.
On another post from here i read that to port pmwiki from one server to another one it is sufficient to copy the wiki.d directory. But in this case i didn't even touch the pmwiki.
Is there a way to get the system going again, or at least to find out what the problem is?
edit:
To clarify:
http://newserver/~QHG/pmwiki/pmwiki.php/QHG2/QHG2
does not work, but
http://newserver/~QHG/pmwiki/test.html
does work
I think, the problem is around .htaccess config and your Clean URLs config.
You can download and install fresh PmWiki package and see if it works from the box. If it works, compare .htaccess and /local/config.php files from both installs to find out what is wrong.
I've tried every solution I've found in the last two days on this and other sites. None work.
I'm trying to set two OS level environment variables/commands for the apache user account on centos 6.10. Apache version is 2.2.5. See final paragraph for why I'm having to do this. Alternative solutions are also welcome.
Specifically these commands/variables:
. /opt/rh/python27/enable
export set CLOUDSDK_PYTHON=/opt/rh/python27/root/usr/bin/python2
I have:
Put them in /etc/sysconfig/httpd and /etc/init.d/httpd
Tried various version of these commands
Switched apache to use bash, created .bashrc in /var/www/, gave apache ownership and set permissions correctly and put them in there. I realize this is bad practice, its a test server and I was out of other ideas.
I can't get them to persist beyond a single exec statement in php (where I still have to call both listed commands) or a single su -s /bin/bash apache -c "[command]" execution.
Does anyone know how to get these to persist for the apache user?
Why am I doing this?
I am doing this because Google Cloud Cloud SDK has PHP code that doesn't work so I'm left with either using CURL or passing exec statements, both of which require this environmental variable nonsense for the executing user. To run Google Cloud SDK commands you have to have version 2.7 of python installed, which you can't upgrade to on centos 6.10 without breaking the OS, unless you install it concurrently somewhere else per: http://jhurani.com/linux/2018/07/30/GCSDK-on-centos6.html doing that means I have to set whatever user account is executing code to use the new version of python. Which is apache in this case. Works fine on my normal user account, but I can't get the apache account to respect these changes beyond a single execution, even though everything I read says that it should.
Any help would be appreciated. Thanks for you time and any insight you'd care to share.
Could you try to export the variables in /etc/sysconfig/httpd
export mydocroot=/var/www/html
Then configure the Virtual Host
<VirtualHost *:80>
DocumentRoot ${mydocroot}
</VirtualHost>
Finally restart the service
systemctl restart httpd
In addition, I found that you can also do it through the .httaccess file with SetEnv assuming that it's enabled on the website.
SetEnv SPECIAL_PATH /foo/bin
That's all you need to add the environment variable into the .htaccess file
I have a code that is 100% fully functional when compiled in g++ and run in terminal. The code uses wget and curl. When I compile it in to a cgi file and have my html webpage call the script then the curl part of the code does not do anything.
What curl is doing is that it is downloading a webpage which is very critical for my program. I have my apache2 server setup, the cgi file is in cgi-bin folder and everything works except the curl doesnt work in the compiled cgi file.
What are some of the ways to fix this? I have tried many things and none of them seem to work. Thank You
It's most likely to be either permissions, paths, or environment variables. Try TEMPORARILY relaxing all permissions - maybe making your curl setuid root and adding in code to check return values and error codes from all your system calls. Try outputting all your environment variables in Terminal and in CGI mode and diffing them.
I have installed Python 27 successfully.
And with respect to project requirement i have also installed following packages.
Django==1.4.3
MySQL-python==1.2.4
PIL==1.1.7
South==0.7.6
argparse==1.2.1
distribute==0.6.28
django-appconf==0.6
django-imagekit==2.0.2
pytz==2012j
six==1.2.0
wsgiref==0.1.2
Now the problem is, i dont know how to make this run, or visible in python.
Can anybody please help me, to get out from this.
I have to change few webservices and also want to add some functionality.
This webservices are attached with wordpress website.
So, please help me to configure whole this project on local (Windows PC).
Thanks in advance
Go for the Touch Command of Django for this issue,
I think it will make helpful to you.
Thanks!
i have solve this, find below instruction for users who have same queries:
Restarting the Spawned Server
If you change any Python code on your site, you’ll need to tell FastCGI the code has changed. But there’s no need to restart Apache in this case. Rather, just reupload mysite.fcgi – or edit the file – so that the timestamp on the file changes. When Apache sees the file has been updated, it will restart your Django application for you.
If you have access to a command shell on a Unix system, you can accomplish this easily by using the touch command:
touch mysite.fcgi
For more information:
http://www.djangobook.com/en/2.0/chapter12.html
Thanks
I have a cgi script that I know works (as far as the code is concerned), but which cannot be accessed through my website. My hosting provider simply states that I need to edit the .htaccess file, but I have no idea what options/handlers I need to set in order to make the contents of a directory execute like c++.
How is this done?
You can't on this service provider. A quick search of the Bluehost Kb gave this: https://my.bluehost.com/cgi/help/48
Our LINUX web servers have the capability to run CGI scripts in your own "cgi-bin" directory. Scripts may be written in Perl, Python and CGI languages.
Here are some helpful tips to follow when installing scripts:
Upload to your cgi-bin directory to ensure proper file permission settings.
All scripts on our server must have permissions set to 755 (rwx-rx-rx). If you need help in changing script permissions, please see our article about setting file and user permissions.
Upload in ASCII transfer mode (and NOT BINARY mode)
The first line of each script must read: a) #!/usr/bin/perl (for Perl) b) #!/usr/bin/python (for Python)
Ensure the permissions are set to 755
However, there is nothing stopping you just trying just putting your exe in the cgi-bin dir and seeing if it runs, but this probably won't work.
In this case, you'd need to relink any C++ against the local target server, and I doubt that Bluehost would facilitate this -- just too much support hassle for the few $ / month that you pay.