Ubuntu Error and Email from Cron? - php

I have been trying to figure out whats going on here... I have looked all over and nothing seems like a solid solution. If anyone knows a link or information on how to fix this it would be greatly appreciated.
Ubuntu 14.04 lts
Microsoft Azure Server
Apache
Drupal site with APC enabled (everything looks good on the drupal side) I just keep getting these annoying emails about the below issue.
I added smtp and mailutils to my server, and now i am getting these errors from what looks like apache / php...
--
Cron [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5 ] && /usr/lib/php5/sessionclean /var/lib/php5 $(/usr/lib/php5/maxlifetime)
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/apc.so' - /usr/lib/php5/20121212/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
Thanks for the help,
-Frank

These are being generated by the /etc/cron.d/php5 cronjob. If you want the errors generated here to stop being emailed, you can set mailto="" on the line before the command in that file. This is probably not your desired solution here, but it is useful to 1) know where you can find where the error is coming from and 2) know how to control its output.
The command generating these errors is likely maxlifetime. You can confirm this by trying to run /usr/lib/php5/maxlifetime and seeing if the same error comes up.
Your apc.so file might be somewhere else. Try "locate apc.so" to find out where it is. If it doesn't exist, I would recommend reinstalling the extension so that it does exist. If it does exist, your /etc/php5/apache2/php.ini file might be having trouble finding it. A couple solutions I read from other threads had people either creating a symbolic link to to the file (a bit sloppy, but it works) or noticing that "extension_dir=" in php.ini was set to something other than "./" so that it was looking in the wrong place (or the "extension=apc.so" entry itself contained some of the path and had a typo or something).
In my case, my php.ini file was trying to load the extension msql.so which didn't exist on my system. I don't know why it would do this, but I commented out the line and the error messages went away. In most cases, though, I would assume the extension was deliberately installed so you would want to go the route of tracking it down or fixing it.
Good luck.

Related

Laravel projects stopped suddenly

Before you continue to read - the issue has been fixed
Well... this is kinda weird.
I'm working on a web app for some friends. I have a working version uploaded to their hosting, and, suddenly, it stopped working a couple of days ago.
I haven't added anything or changed anything on the server. There is no error, simply the app stopped loading and a blank html page is loaded instead.
I've traced the problem until /vendor/composer/autoload_real.php file.
In the end of the static class inside this file, there is a loop where several other files are being included (actually requested), I've checked that when it tries to request /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php, the system stops. Obviously, I've checked that the file is there, and it isn't been touched.
Well, I'm positive I've didn't changed anything on this part of the app (it's core framework, and I usually don't mess up inside), but just of a sudden it stopped working.
The working copy on my computer just works fine. I've uploaded my copy of helpers.php, but nothing changed.
Anyone had experienced similar issues recently? Anyone has any idea about how to fix it?
EDIT: It's been several days since I could check on this for the last time.
Now I've been tracing raw php execution on /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php file. This is, I've started echoing messages and trying to execute just this file, to see where code execution is stopped.
I know this is very crappy debugging, but I haven't access to apache nor I can restart it, and it seems there is no easy way to get an error code without this.
So patiently trying I've reached two points where execution stops on this file:
Creation of factory method
if (! function_exists('factory')) {
/**
* Create a model factory builder for a given class, name, and amount.
*
* #param dynamic class|class,name|class,amount|class,name,amount
* #return \Illuminate\Database\Eloquent\FactoryBuilder
*/
function factory()
{
$factory = app(EloquentFactory::class);
$arguments = func_get_args();
if (isset($arguments[1]) && is_string($arguments[1])) {
return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);
} elseif (isset($arguments[1])) {
return $factory->of($arguments[0])->times($arguments[1]);
}
return $factory->of($arguments[0]);
}
}
and creation of mix method
if (! function_exists('mix')) {
/**
* Get the path to a versioned Mix file.
*
* #param string $path
* #param string $manifestDirectory
* #return \Illuminate\Support\HtmlString|string
*
* #throws \Exception
*/
function mix($path, $manifestDirectory = '')
{
return app(Mix::class)(...func_get_args());
}
}
In both cases func_get_args is involved... I haven't a specific error, but I have the tingling that the problem is related somewhat to the fact that this function isn't returning anything.
EDIT2: Ok, I tried php artisan and composer commands suggested on answers to no success. The issue is still there.
I've also deleted the logs and checked that no new log was created while trying to load the site.
I've tried a clean laravel install from scriptaculous on a new directory (I've done this when I first uploaded the site, it worked perfectly for several months) and this new install doesn't reach the front page neither. A blank page (on Firefox) or a 500 error (on Chrome) is shown instead.
I forgot to mention an important data. My app is sharing space with a wordpress instance. The wordpress is installed on public_html, and my site on public_html/mySiteDirectory. This hasn't supposed any problem so far more than make me tweak lightly .htaccess file to make routing work fine.
There is also a phpbb forum sharing space on it's own directory inside public_html.
I wonder if any of those could have somewhat been upgraded and produced this strange outcome.
Also... laravel app_debug is enabled on .env file since the beginning, but never showed anything. This seems to be something that fails before laravel framework is fully loaded.
EDIT 3: IT'S FIXED.
Well... first of all, let me thank you all for your help. Actually there wasn't one answer that fixed the problem, but many of you suggested to use phpInfo() to check php version which ultimately led to the true problem.
Yes... surprisingly, although php -v on terminal showed php 7.2 running on server, and cpanel php management tools showed also php 7.2 installed and running, when I used phpInfo(); php 5.6 was showed on the response.
I used the own cpanel tools to make an upgrade/downgrade to 7.3 and again to 7.2 and et voilá phpInfo(); shows 7.2 and the page is again up and running.
I'll try to share the reward between several answers (don't know if something like that is even possible), and will +1 every answer suggesting phpInfo(); as it showed as the key to fixing this problem.
If I cannot share the reward I'll accept as final answer the one from Don't Panic, as it was the one that convinced me that there was a problem with php versions.
If you look at the code in the functions you have traced the problem to, both contain interesting or less-common PHP features:
factory() includes ??, the null coalescing operator. This was introduced in PHP 7.0.
I see in a comment you added to another answer that you are using PHP 7.2. This question describes Laravel failing in factory(), because even after upgrading to PHP 7.2, and phpinfo() showing 7.2, Apache was still using PHP 5.6. This seems unlikely, but when all else fails ... ?
mix() includes ..., the spread or splat operator. This was introduced in PHP 5.6, but there are reports of it failing in Laravel with 7.x due (AFAICT) due to mismatches between the PHP versions Apache and the CLI are using.
Considering you mentioned you uploaded the code from your local machine (rather than using php composer install), and that CPanel tends to update PHP automatically and silently, this seems like a possibility - there are 4 PHP versions in play (CLI/web on your machine, and CLI/web on server), and they all need to be in sync.
As a side note, as you've already discovered you are really working blind without the logs. Either the PHP and/or Apache logs will give you more info, typically describing exactly the problem, and save you having to manually trace things as you've been doing. If those logs aren't showing anything, maybe PHP isn't configured to log errors - try enabling that.
It probably depends on your CPanel version and config, but standard locations for your logfiles are typically:
Apache access log: /usr/local/apache/domlogs/<your-username>/
Apache error log: /usr/local/apache/logs/error_log
PHP error log: /home/<your-username>/public_html/error_log
Start wtih composer dumpautoload. Then run php artisan optimize:clear. Re-upload the whole site and you should be good to go. I have experienced a very similar issue. Do you run a pipeline on the server or are you just FTP-ing the site up? Are you able to run composer on the server and the same for artisan? If you can, you need to those commands there are as your cache is often based on your host computer drives and will fail in prod.
Simply replacing the file might not be helpful. Try enabling the error log or check if you are able to reach this file bootstrap/app.php. If yes it means there is no problem in the composer. Try checking the version of PHP installed and if it is compatible with your Laravel. Try checking PHP Error Log. It might be helpful.
Ok I should mention a few things
1: Go to storage/logs directory and delete all *.log files then you refresh the web page and you'll check out to see for any log file if there is no log file it means it's related to server configuration and etc. if there is a log file you read it and you post it in here
2: Did you pull the code on cpanel by console command using version control system like git or svn or you just uploaded it in a classic way, if you indeed pulled it with VCS you may did a composer update instead of composer install which will updates all packages as possible as defined in composer.json file and you may have got a higher version of vendor than your local and something may broke in there.
3: You may have a different php version on server vs your local which many times casing real problems.
I can't tell for sure until you post your log file here
So here is what i would have done.
If it is possible simply turn0on debugging, this will show you the error in the web browser itself (you can do that from .env file)
You can also read the laravel log file for errors as mentioned earlier.
If you do not want to do this, run the following commands
PHP artisan cache:clear
PHP artisan route:cache
PHP artisan config:cache
PHP artisan clear-compiled
PHP artisan optimize
If you could share more details that would help...
Have you checked permissions and ownership for storage and bootstrap/cache folder?
these permissions need to be set for the app to work
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
I tried everything and nothing worked. The best solution for me was that I deleted cpanel files and reuploaded all the codes.

Apache in MAMP Pro 4 has stopped working, refuses to start

Have been using MAMP Pro for a fair while - version 3 primarily, upgraded to 4 a while ago.
I haven't had any unusual issues at all, but today the Apache service failed to start, telling me to check the error logs. The logs were blank unfortunately... I've made no system configuration changes, no changes to MAMP/MAMP Pro. Shut down my system yesterday, started today, it no longer works...
I've tried numerous suggestions found via Stack Overflow and Google without any success.
Even after completely uninstalling and re-installing MAMP Pro I am unable to get the service to start.
Nothing appears in the logs...
When starting it manually on the command line it comes up with a PHP related error:
$ Applications/MAMP/bin/apache2/bin/apachectl start
httpd: Syntax error on line 135 of /Applications/MAMP/conf/apache/httpd.conf: Cannot load /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so into server: dlopen(/Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so, 10): image not found
The confusing thing is that I don't have PHP 5.2.17 specified anywhere, at all - according to MAMP Pro it should be using PHP 7.0.12.
If I add PHP 5.2.17 to MAMP using the appropriate MAMP Pro dialogs, Apache still fails to start via the MAMP Pro interface. I can now start it manually from the command line however, but none of my virtual hosts/etc seem to be loaded.
apachectl -V tells me it's using /Applications/MAMP/conf/apache/httpd.conf, but there is nothing in that file that has any reference to any of the configs generated in /Library/Application Support/appsolute/MAMP PRO/conf
It also looks like hosts entries aren't added to /etc/hosts.
Even if I tell /Applications/MAMP/conf/apache/httpd.conf to do nothing but include /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf (and manually add entries to /etc/hosts) it still doesn't seem to work at all...
I and my colleagues are at a complete loss, especially given it was working yesterday...
Has anyone had any issues like this?
I managed to fix the similar issue you had.
My Apache server was working fine and then following updating to 4.0.6 I experienced similar issues.
There were 2 things I did to fix the issue. I was getting the same error where it couldn't find a php file in 5.2.17. After fixing that by adding 5.2.17 to MAMP I experienced an apache error regarding user permissions.
(22)Invalid argument: getpwuid: couldn't determine user name from uid 4294967295, you probably need to modify the User directive
File > Edit Template > Revert ALL Templates to Default Settings.
Save & restarted the servers and all worked finally and all my hosts had retained as well.
I had previously entered a custom line in my httpd.conf file that for countless versions had copied across fine however it looks like the folder structure had changed and so couldn't locate it causing the unusual error about User permissions. I have since re-entered the custom line with the correct structure and all working fine again.
Hope this helps.

Make latex fonts available for all users for a php compilation

I'm having problems with compiling a latex document using PHP shell_exec. I thought I had solved the problem, but alas I did not.
I have asked somthing similar before:
Compiling a latex document from PHP
And this answer led to me believe that the problem is simply the fact that the www-data user that executes the php scripts doesn't have access to the right font file.
It seemed that this page had the solution:
How can I get PHP to compile a LaTeX document if it (www-data) can't get access to the required packages?
What I did is log as root, execute the command and it threw a bunch of text but no error was reported. Then I tried my webpage again, and the font not found error was still there.
Every time I try a compilation I get the error:
<inti.pdf, id=1, 533.995pt x 298.11375pt> <use inti.pdf> [1{/var/lib/texmf/font
s/map/pdftex/updmap/pdftex.map} <./inti.pdf>]
(./report.aux) )
!pdfTeX error: pdflatex (file ecrm1095): Font ecrm1095 at 600 not found
Don't know if the first part of the message is important or not so I copied it anyways (inti.pdf is a picture in the report.tex).
The missingfont.log file has this line:
mktexpk --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecrm1095
How can I make the font be seen by the system. Maybe setting a environment variable? Or a Sudo command so that the font will permanently be seen by all users?
Ok, so I found a workaround/another clue to the problem. I'm only posting it here so it might help anyone else.
Firs of all, I was wrong. This is not a user permission issue. I changed my server username to my own and I still had the font not found problem.
However I was able to isolate the problem to one of the latex lines.
In particualar it started working correctly as soon as I commented:
\usepackage[T1]{fontenc}
The line was inherited from a header I always use, but was not fundamental to the document and hence this managed to solve it.

PHP error while sending email

I am new to PHP. I am trying to send email through PHP.
The error I got while sending is:
[23-Sep-2014 15:31:08 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20100525/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20100525/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0
[23-Sep-2014 15:31:08 UTC] PHP Fatal error: Directive 'allow_call_time_pass_reference' is no longer available in PHP in Unknown on line 0
cannot open shared object file: No such file or directory in Unknown on line 0
I don't know how to solve this. I browsed a lot they said some suggestions.
I am new to PHP and I can not find the solution(s) for this.
Hope you guys help me to complete my first PHP task successfully...
Thanks in advance...
EDIT : Sorry friends even hello world is not working.. I dont know what to do now whether iwant to install anything... Forgive me for asking very silly questions.. Though am very new am struggling..
Check if /usr/local/lib/php/extensions/no-debug-non-zts-20100525/ixed.5.2.lin really exists.
(i guess it does not)
After that, you should find it:
locate ixed.5.2.lin
and put it into the location your php is looking for.
(/usr/local/lib/php/extensions/no-debug-non-zts-20100525/)
If locate does not give any results, you have to install the missing library ...
Remark: to do locate, you will need a console, preferrably with root access.
Edit: Also please check if a simple print('hello'); would work, if not, you should fix your PHP install first.
Check if the binary exists in extension directory on the server OR the extension directory is correctly defined in php.ini. These are the possibilities which is causing problems. Also try setting permissions to 755 on ixed.5.2* once and see if that makes the trick.
Thank you so much for all who spent your time to take part in my issue.
I solved that by contacting my server person..
There is some issue in my curl file, One ; is missed out in that.
Now everything works fine..
Special Thanks for Gipsk Jakab .... His answer narrowed my prob...

how do I fix my suhosin.so error

I'm (very) new to databases. I've designing a site, and was happy that I got a handle on the errors in my error log. Recently my error log keeps logging in "PHP Warning: ...unable to load...suhosin.so"
Obviously a new entry is made whenever I query something. Unfortunately, google searches tell me 2 things: (1)the error isn't really a big thing (but I was proud that my error log stopped growing!) and (2) suhosin.so is an advanced topic (and security patch) for mysql.
The advanced part has me a bit freaked out as to how I can "fix" it...
Please help.
It says extension=suhosin.so somewhere in your php.ini. You can either remove or comment out this line to disable the protection, or install the current suhosin extension from suhosin.org. Simply
grep -r suhosin.so /etc/php5
(The path may be different on your system.)
Suhosin is an advanced protection system for PHP. (not mysql)
Try this...
(1) Install suhosin extension from suhosin.org if it's not installed yet
(2) Un-comment (by removing #) extension=suhosin.so from your php.ini file
(3) Restart your web-server (Apache?)
This should fix your suhosin.so error.

Categories