I have RHEL server on which PHP websites are hosted using Apache web server. In one website I'm using PHP Curl library to connect to some services. These services make use of SSL (https).
When I browse any PHP page which makes SSL calls using Curl, I get below error:
Problem with the SSL CA cert (path? access rights?)
If I run the same PHP script from command-line on my server, it works fine. Only when I browse it I get above error.
I have already tried the solution given in http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/ but it does not work.
If there is anything else I need to do, please let me know.
As mentioned earlier, I tried the solution given at http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/
However, the Apache server was not taking the php.ini changes even after restarting it. When I restarted my Linux machine, it worked. Looks like Apache might be caching php.ini somewhere and it got cleared only by restarting machine.
Hypothesis:
Could be that the user that's running Apache is so restricted that it can't get at the curl CA store. Try logging in as the web user, e.g. www-data and cd'ing to the directory with curl's files. At some time you might get an access-denied error. Finally try cat to display the file (still as Apache user). You could get an access-denied error there too.
Wherever the error occurs, either open up the permissions to allow the Apache user to access the file, or run Apache as another user.
Related
I have a website that makes extensive use of php. I had everything running fine until I needed to call a Python script using exec() in php.
After researching the problem I decided what I really needed, for a variety of reasons, was php-fpm. I have installed php-fpm, I believe. But when I attempt to use my browser to reach /phpinfo.php I get a 503 error.
I can access any .html file on the site using my browser, but attempting to load any .php file results in a 503 error.
Since I can access the .html fees I know that Apache is working, but I can't rule out this being a problem between php and Apace on the Apache side.
What might be the problem here?
AWS Linux was not recognizing the php.ini file properly.
This was the last straw. I switched everything to Ubuntu 18.04 on AWS. Everything is working now.
I have been developing a php project and the wamp server was seems
working fine but suddenly it stops working and i don't know what to do
because when i check its status it says server online and green icon is also
showing but it just does not work whenever i run .php files, Mr. browser
just write it down as i did in notepad++ but before some days it was working
fine, please help me I'm kinda stuck?
I also want to mention that in the mean while I installed tomcat server for some other work is it anything to do with fault because i'm pretty sure both operating on differnet port numbers
use <?php instead of <?or left click wamp > php > settings > short_open_tags
and make sure you are running your scripts through localhost and not just opening the php file in the browser
Read More about wamp problem
If you're definitely viewing the script through your MAMP setup (if your URL bar starts with http:// instead of file://) and it is showing the contents of the PHP file instead of executing the script, it sounds like Apache is running fine, but PHP-FPM is the issue or a misconfiguration between the two. Apache should detect it is a PHP script and ship it to the PHP-FPM process, accept a response then ship it to your browser.
I would recommend checking PHP-FPM logs first. All logs are in MAMP/logs - scroll to the bottom of each one for latest entries. Ensure the service is running as expected and logging hits when Apache serves a .php file. PHP-FPM may be using a socket file (which can hit permission problems) or on a network port (which can be in use/require admin privileges/etc). Otherwise check your config files, or re-install MAMP for fresh config files.
If Apache cannot start, common reasons are;
The port is in use by another application
The port is a low number and you do not have administrator privileges to use that port
Switching from wired to wireless / switching network adapters / changing hostname, etc
Apache is already running, or Apache thinks it is
You must sign out from Skype it'll occupied the port of Apache or you should turn down the server and then restart you pc and turn it on. It will work fine.
I installed LAMP on my linux laptop one month ago and it was still working fine. But then recently I can't access phpmyadmin. It always pops up this error:
Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.
I tried clearing the cache and cookies of my Mozilla browser but it still won't work. By the way, I'm new to Linux so I'm having a hard time configuring what might went wrong.
Try giving Read Write permission to the folder
sudo chmod 777 /var/lib/php/session/
I have a joomla GIT repository of my project. We are using wamp and windows 7 as a development environment. This repository works fine on one machine. But when we tried to clone same repository on other two machines, we are facing a strange error.
Error is: Error 0 couldn't connect to host
As shown in screenshot.
All other repositories on those two machines work fine.
There is no error logged in under any of error logs file (apache, php and mysql).
I enabled joomla's error reporting. Searched on Google but, no luck.
Please help.
Thanks.
When you clone your Joomla to another machine, there are several things you need to double check:
Not only the files from the GIT, make sure the database is the same on the other two machines as well (export from the first one, import to 2 other one using phpMyAdmin).
Make sure the configuration.php file on two other machines re-corrected, includes: path to logs, tmp folders; database information (host, username, password, database name).
It should works.
Well, I debugged little bit more and finally found the solution. It was a small issue with missing web service link in one table. We are using com_api for web services. On first machine web service link value in table was local value respective to that machine.
On remaining two machines, we updated this to local value of those respective machines.
And it worked :)
This is not a standard Joomla error - it's either that this error is thrown by an extension or it is a server error.
Try adding a die(); at the beginning of your index.php file and see if it actually dies, if it doesn't, then this is definitely a server error.
If it does die, the use the function: get_included_files() and then make a quick search on all the files included on that page for the sentence "Couldn't connect". You will find the culprit easily this way.
Check your .htaccess file, maybe they have some rule which can not be met. (Rename this file if it exists and see what happening)
But I think that the problem is in the network settings. Errors often come from dns issues or, curl connection restrictions.
Check your DNS records
Check your Curl settings and try to create any Curl request.
Check your .htaccess
I don't think this error related to Joomla , I think it is connection from PHP to Linux, try to change the port of the Linux.
and restart the Apache and try again.
I'm running 5.2.14 with IIS on Windows 7. Used the Windows Platform Installer.
When I write a script that uses cURL or file_get_contents() and run it via the commandline, everything works great.
If I use the same code in a web page, running in IIS, the request always fails. cURL returns a response code of 0. file-get_contents comes back with "Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known". I even tried putting the code in a separate script and running it via exec() to pipe the output back to my web script. But the script, which works fine from the CLI, fails when called by a PHP script being executed by IIS.
php.exe -i returns no errors. phpinfo() run via IIS in a web page shows the same active/activated cURL as in php.exe -i. My libeay.dll and ssleay.dll libraries are all over my path.
There doesn't seem to be a problem with cURL itself. My best guess is that this is a firewall thing or a permissions thing, where IIS runs PHP as a guest user who is blocked from network access, but when I run it from the commandline, I'm not blocked.
I don't know enough about configuring IIS or the firewall or security policies to figure out where to change things and I don't want to accidentally open up a big hacker tunnel into my system by just randomly lowering security until something clicks. Please help.
"Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: No such host is known".
That's your clue, No such host is known, try a raw IP address see if that works, if so then it's because PHP can't see hosts basically IIS isn't passing that info in perhaps.