Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ZahidGopang's avatar

Error at Export excel

Hey team i have around 47k records in db with multiple joins excel getting export with 1000 limits but not all data getting server error " This page isn’t working " " HTTP ERROR 500 "

Help and reply is highly appreciated as i have to reports my manager please

public function collection()
    {

        $count = UserServices::join('users as u', 'u.id','=', 'user_services.user_id')
            ->join('servicesubscriptioncharges as scc', 'scc.id','=', 'user_services.service_subs_charge_id')
            ->leftJoin('services_types as st', 'st.id','=', 'user_services.service_type_id')
            ->join('services_sub_categories as ssc', 'ssc.id','=', 'user_services.service_sub_category_id')
            ->join('services_categories as sc', 'sc.id','=', 'ssc.category_id')
            ->where('user_services.paid_amount','>', 0)
            ->where('user_services.service_amount','>', 0)
            ->orderBy('user_services.id','desc')->count();
        
        $off_ex = 1000;
        
        $aAllData = [];
        
        for($j = 0;$j < $count/$off_ex;$j++){
            
            $aAllData[] = UserServices::SELECT
            (
                \DB::raw("CONCAT('#',user_services.reference_id)  as reference_id"),
                'u.name as User',
                'user_services.service_location as location',
                'scc.sub_charges_title as sub_charges_title',
                'scc.sub_charges_amount as sub_charges_amount',
                'st.services_type_title as services_type_title',
                'sc.category_title as category_title',
                \DB::raw("
                (
                CASE WHEN user_services.service_status = '1'
                THEN 'Active'
                ELSE 'InActive'
                END) 
                AS service_status"),
                \DB::raw("
                (
                CASE WHEN user_services.service_payment_status = '1'
                THEN 'Paid'
                ELSE 'UnPaid'
                END) 
                AS PaidStatus"),
                'user_services.service_start_date'
            )
            ->join('users as u', 'u.id','=', 'user_services.user_id')
            ->join('servicesubscriptioncharges as scc', 'scc.id','=', 'user_services.service_subs_charge_id')
            ->leftJoin('services_types as st', 'st.id','=', 'user_services.service_type_id')
            ->join('services_sub_categories as ssc', 'ssc.id','=', 'user_services.service_sub_category_id')
            ->join('services_categories as sc', 'sc.id','=', 'ssc.category_id')
            ->where('user_services.paid_amount','>', 0)
            ->where('user_services.service_amount','>', 0)
            ->orderBy('user_services.id','desc')->skip($j*$off_ex)->take($off_ex)->get();
            
        }
        
    
        return collect($aAllData);
        

    }
public function headings(): array
    {
        return [
            '#',
            'User',
            'Location',
            'subs Charges Title',
            'Subs Charges Amount',
            'Service Type',
            'category',
            'Status',
            'PaidStatus',
            'Service Start Date'
        ];
    }
0 likes
15 replies
tykus's avatar

Check the application's log for the full error message and stack trace.

Sinnbeck's avatar

Start by checking both laravel.log and your webserver log. Knowing what the error is would be a good start

Sinnbeck's avatar

@ZahidGopang then check the webserver log. Without seeing the error page I cannot tell if it's a php error or general server error

tykus's avatar

@ZahidGopang I would guess that you are running out of memory; check you web server logs as well.

ZahidGopang's avatar

@Sinnbeck i have checked in cpanel error logs no any error related to this or no any recent error related to this

ZahidGopang's avatar

@Sinnbeck some htaccess issue is there and permission denied i found but that issue time was not updating when i am hitting export again and again to generate issue but that time was not updated though error date was current.

ZahidGopang's avatar

getting this error

@Sinnbeck --29935b41-Z--
--15ec1243-A--
[27/Aug/2022:11:48:46 +0000] YwoElnaFyPrNPdYZ7sBrKwAAAAc 119.160.69.86 58888 172.26.2.185 443
--15ec1243-B--
GET /admin/export_financial_report HTTP/1.1
Host: pinss.io
Connection: keep-alive
sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: https://pinss.io/admin/dashboard
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,da;q=0.8
Cookie: _ga=GA1.2.68815031.1661146175; _gid=GA1.2.2033632034.1661338147; timezone=Asia/Karachi; cpsession=pinss%3aHHg4EklYkCM6h36B%2cec2645bdd4a33f4220574080ba0db3c4; _gat_UA-117050492-1=1; XSRF-TOKEN=eyJpdiI6IjVhSDloVEVXZ25qSHl5N1IzYkFEZnc9PSIsInZhbHVlIjoicjdTQkZITjh3TEoySTN2QTJEdmNZTjM0dTA1eHhNUGR3ZnF1enhueXphc29FQjZzKzJkenZlVFpLNjFoZlJ1RjI1V09HQW90bG9YcEFiTnFtMHZac216cUZlWDlsVXpSWmZjczl0YmoyQnBJQU5aR0h1MUZVa2VHSHFWZDkzY1AiLCJtYWMiOiI3YTIwMTk3ZWUyNzkzYmQzNjhiZDY1M2I3YjUwMjFiMTg5NGJiYWU3OTdhNGQyMGQ2OTRhYWNiYWYwZmQ1ZWQxIiwidGFnIjoiIn0%3D; mobile_classifieds_pems_session=eyJpdiI6ImdZWUM3aG9NYzlOZG5aZ3Y2MVB4clE9PSIsInZhbHVlIjoiWFRXTFBzZzA4ZWJrcVdPUkZ5M1V6UHpkeUxrMUVPQU0wd3RtNlk1anNtdjI5YThNVnczTCtIaFd3YllYTDFJMXRQV3NzTzBnZ0V5Kzg5NUkwNUdzS1N0b1RGNGZrS3FhZXdnaGRoeWFrUkZkbEFkS1hrZXFFSUo4VUdUc2pBK2ciLCJtYWMiOiJhZmY1NzRjYzFhODE5MGU5NTFmOGVjM2Y2ODZiYjNmNmVjODIzZTU5NDk3YjkzYjVhYzI0YTEwMzNhZjIyZWE1IiwidGFnIjoiIn0%3D

--15ec1243-F--
HTTP/1.1 200 OK
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

--15ec1243-H--
Message: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-global": Permission denied
Message: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-ip": Permission denied
Apache-Error: [file "apache2_util.c"] [line 271] [level 3] [client 119.160.69.86] ModSecurity: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-global": Permission denied [hostname "pinss.io"] [uri "/index.php"] [unique_id "YwoElnaFyPrNPdYZ7sBrKwAAAAc"]
Apache-Error: [file "apache2_util.c"] [line 271] [level 3] [client 119.160.69.86] ModSecurity: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-ip": Permission denied [hostname "pinss.io"] [uri "/index.php"] [unique_id "YwoElnaFyPrNPdYZ7sBrKwAAAAc"]
Apache-Handler: proxy:unix:/opt/cpanel/ea-php80/root/usr/var/run/php-fpm/e43d9e5bebf3e4df136827a36f6da5d361779c8d.sock|fcgi://pinss.io
Stopwatch: 1661600918533165 8073934 (- - -)
Stopwatch2: 1661600918533165 8073934; combined=2914, p1=274, p2=2417, p3=0, p4=0, p5=140, sr=71, sw=2, l=0, gc=81
Producer: ModSecurity for Apache/2.9.3 (http://www.modsecurity.org/); OWASP_CRS/3.0.2.
Server: Apache
Engine-Mode: "ENABLED"

--15ec1243-Z--
ZahidGopang's avatar

@Sinnbeck error message

Message: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-global": Permission denied
Message: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-ip": Permission denied
Apache-Error: [file "apache2_util.c"] [line 271] [level 3] [client 92.97.189.157] ModSecurity: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-global": Permission denied [hostname "pinss.io"] [uri "/index.php"] [unique_id "YwoCc3bGPlVFRz7DqtxaGwAAAAU"]
Apache-Error: [file "apache2_util.c"] [line 271] [level 3] [client 92.97.189.157] ModSecurity: collections_remove_stale: Failed to access DBM file "/var/cpanel/secdatadir/pinss-ip": Permission denied [hostname "pinss.io"] [uri "/index.php"] [unique_id "YwoCc3bGPlVFRz7DqtxaGwAAAAU"]
ZahidGopang's avatar

@tykus

1) Navigate to EasyApache 4 in WHM.
2) Customize your current profile.
3) Navigate to "Apache Modules" and tick "mod_ruid2" off.
4) Search for mod_suexec and enable it.
5) Select "Review" on the left-hand side and provision the new Apache build.

Done with these steps thanks every one

1 like

Please or to participate in this conversation.