Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5973505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:48:34+00:00 2026-05-22T20:48:34+00:00

I use a php script to generate a LaTeX file (report.tex) on my local

  • 0

I use a php script to generate a LaTeX file (report.tex) on my local OSX 10.6.7 with MAMP (tThe filesystem is HFS+).
Then I use exec() to build the file using LaTex. The .tex is well created on the filesystem, but it is not recognized as a .tex file by the finder, nor by LaTex.
I’ve checked that the problem is not in the file itself, but in the way the php script has created it.

Indeed, if I use a text editor to create report.tex, the file is correctly handled by the system and makes no problems with LaTex. If I run the php script, it creates another file, with the same name(!), in the same dir.
Internally, these files are exactly the same, checked with an hex editor.
If I run an ls -ls@ in the dir, I obtain

8 -rw-r--r--@ 1 tom  staff     871  4 jui 12:30 report.tex
    com.apple.FinderInfo        32 
    com.apple.TextEncoding      15 
8 -rw-r--r--  1 tom  staff     805  4 jui 12:35 report.tex

The last file is the php-generated one. If I run xattr -p com.apple.FinderInfo on the first file, I get

54 45 58 54 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

and if I run xattr -p com.apple.TextEncoding,

UTF-8;134217984

I can open the second file without problems, once the text editor is specified (this file is not recognized as a .tex but the first one is!). The file then shows fine in TextWrangler, but the syntax coloration of tex is not activated (it is activated for the first one and their contents are the same bytewise).

I’m pretty sure these problems are related to this extra attribute thing.
My question is : is there a way, with PHP or OSX, to achieve a correct behavior, that is the file created by php is recognized as a normal .tex file and for example, overwrites the first one (and of course can be processed by LaTex)?

Regards,

Tom

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:48:35+00:00Added an answer on May 22, 2026 at 8:48 pm

    The extended attributes are a red herring since files in a directory are not differentiated by their attributes, only their name. So you cannot have two files with the same name in the same directory. Almost certainly the problem is that one of the file names has an unprintable character in it, most likely a space. Here’s an example:

    $ echo "hi" >"a.php"
    $ echo "hi" >"a.php "
    $ ls -l
    total 16
    -rw-r-----  1 nad  wheel  3 Jun  4 10:03 a.php
    -rw-r-----  1 nad  wheel  3 Jun  4 10:03 a.php 
    $ for f in * ; do echo ">$f<" ; done
    >a.php<
    >a.php <
    

    You can do something similar to check the file name. Check your PHP code for how you create the file name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to use the php script to generate PDF with a simple
Here is an example: this script would generate data. #!/opt/local/bin/perl use Data::Dumper; use strict;
I have use include ('base.php') script in my other scripts ( more.php ). Now
This question is simple. What function would I use in a PHP script to
I use a php form processor script that works fine. Except when users submit
I want to execute a php-script from php that will use different constants and
When I use dns_get_record within a php script to get a list of DNS
Why should I use <?php instead of <? in my php script?
I am trying to use NuSoap in PHP 5.3. When I debug my script
I'm trying to write a php script that will generate a variety of new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.